Bayeux  3.4.1
Core Foundation library for SuperNEMO
Public Types | Static Public Member Functions | List of all members
datatools::logger Struct Reference

Organise logging functionality under one roof. More...

#include <bayeux/datatools/logger.h>

Public Types

enum  priority {
  PRIO_ALWAYS = -1, PRIO_UNDEFINED = 0, PRIO_FATAL, PRIO_CRITICAL,
  PRIO_ERROR, PRIO_WARNING, PRIO_NOTICE, PRIO_INFORMATION,
  PRIO_DEBUG, PRIO_TRACE
}
 Priority levels for logging from most to least critical. More...
 

Static Public Member Functions

static priority get_priority (const std::string &name)
 
static std::string get_priority_label (priority p_)
 
static bool is_undefined (priority p_)
 
static bool is_fatal (priority p_)
 
static bool is_critical (priority p_)
 
static bool is_error (priority p_)
 
static bool is_warning (priority p_)
 
static bool is_notice (priority p_)
 
static bool is_information (priority p_)
 
static bool is_debug (priority p_)
 
static bool is_trace (priority p_)
 
static priority extract_logging_configuration (const datatools::properties &config_, priority default_prio_=datatools::logger::PRIO_FATAL, bool throw_on_error_=true)
 
static void declare_ocd_logging_configuration (datatools::object_configuration_description &, const std::string &default_value_="fatal", const std::string &prefix_="", const std::string &from_="")
 

Detailed Description

Organise logging functionality under one roof.

Member Enumeration Documentation

◆ priority

Priority levels for logging from most to least critical.

Enumerator
PRIO_ALWAYS 

Always print the message.

PRIO_UNDEFINED 

Undefined/invalid priority.

PRIO_FATAL 

A fatal error. The application will most likely terminate. This is the highest priority.

PRIO_CRITICAL 

A critical error. The application might not be able to continue running successfully.

PRIO_ERROR 

An error. An operation did not complete successfully, but the application as a whole is not affected.

PRIO_WARNING 

A warning. An operation completed with an unexpected result.

PRIO_NOTICE 

A notice, which is an information with just a higher priority.

PRIO_INFORMATION 

An informational message, usually denoting the successful completion of an operation.

PRIO_DEBUG 

A debugging message.

PRIO_TRACE 

A tracing message. This is the lowest priority.

Member Function Documentation

◆ declare_ocd_logging_configuration()

static void datatools::logger::declare_ocd_logging_configuration ( datatools::object_configuration_description ,
const std::string &  default_value_ = "fatal",
const std::string &  prefix_ = "",
const std::string &  from_ = "" 
)
static

◆ extract_logging_configuration()

static priority datatools::logger::extract_logging_configuration ( const datatools::properties config_,
priority  default_prio_ = datatools::logger::PRIO_FATAL,
bool  throw_on_error_ = true 
)
static

return the priority level from a collection of properties The following properties are recognized: logging.priority : string = "fatal" # or "trace", "debug",

"information", "notice",

"warning", "error", "critical"

Shortcuts to activate some specific priorities: a) logging.debug : boolean = 1 debug : boolean = 1 is equivalent to : logging.priority : string = "debug"

b) logging.verbose : boolean = 1 verbose : boolean = 1 is equivalent to : logging.priority : string = "notice"

Note that the "logging.priority" property has precedence on "logging.debug" (or "debug") and "logging.verbose" or ("verbose").

Parameters
config_a collection of properties to be searched
default_prio_the default logging priority threshold
throw_on_error_is true, an invalid logging priority label triggers an exception
Returns
the priority as configured from the properties

◆ get_priority()

static priority datatools::logger::get_priority ( const std::string &  name)
static

return priority enumeration value from string The string can take three forms for matching, e.g. the PRIO_FATAL priority would be returned from input strings "PRIO_FATAL", "FATAL" or "fatal".

Parameters
namepriority name
Returns
the matching priority enumeration or the PRIO_UNDEFINED if the name is not valid

◆ get_priority_label()

static std::string datatools::logger::get_priority_label ( priority  p_)
static

return priority label from the priority enumeration value

Parameters
p_priority enumeration
Returns
the matching priority label or the empty string if the priority is not valid

◆ is_critical()

static bool datatools::logger::is_critical ( priority  p_)
static

check if priority satisfy the critical level

Parameters
p_priority enumeration
Returns
true if the priority is at least at the critical level

◆ is_debug()

static bool datatools::logger::is_debug ( priority  p_)
static

check if priority satisfy the debug level

Parameters
p_priority enumeration
Returns
true if the priority is at least at the debug level

◆ is_error()

static bool datatools::logger::is_error ( priority  p_)
static

check if priority satisfy the error level

Parameters
p_priority enumeration
Returns
true if the priority is at least at the error level

◆ is_fatal()

static bool datatools::logger::is_fatal ( priority  p_)
static

check if priority satisfy the fatal level

Parameters
p_priority enumeration
Returns
true if the priority is at least at the fatal level

◆ is_information()

static bool datatools::logger::is_information ( priority  p_)
static

check if priority satisfy the information level

Parameters
p_priority enumeration
Returns
true if the priority is at least at the information level

◆ is_notice()

static bool datatools::logger::is_notice ( priority  p_)
static

check if priority satisfy the notice level

Parameters
p_priority enumeration
Returns
true if the priority is at least at the notice level

◆ is_trace()

static bool datatools::logger::is_trace ( priority  p_)
static

check if priority satisfy the trace level

Parameters
p_priority enumeration
Returns
true if the priority is at least at the trace level

◆ is_undefined()

static bool datatools::logger::is_undefined ( priority  p_)
static

check if priority is defined

Parameters
p_priority enumeration
Returns
true if the priority is undefined

◆ is_warning()

static bool datatools::logger::is_warning ( priority  p_)
static

check if priority satisfy the warning level

Parameters
p_priority enumeration
Returns
true if the priority is at least at the warning level

The documentation for this struct was generated from the following file: