Belle II Software  release-05-01-25
LogConfig Class Reference

The LogConfig class. More...

#include <LogConfig.h>

Public Types

enum  ELogLevel {
  c_Debug,
  c_Info,
  c_Result,
  c_Warning,
  c_Error,
  c_Fatal,
  c_Default
}
 Definition of the supported log levels. More...
 
enum  ELogInfo {
  c_Level = 0x01,
  c_Message = 0x02,
  c_Module = 0x04,
  c_Package = 0x08,
  c_Function = 0x10,
  c_File = 0x20,
  c_Line = 0x40,
  c_Timestamp = 0x80,
  c_NoVariables = 0x100
}
 Definition of the supported log message information. More...
 

Public Member Functions

 LogConfig (ELogLevel logLevel=c_Default, int debugLevel=c_DefaultDebugLevel)
 The LogConfig constructor. More...
 
void setLogLevel (ELogLevel logLevel)
 Configure the log level. More...
 
ELogLevel getLogLevel () const
 Returns the configured log level. More...
 
void setDebugLevel (int debugLevel)
 Configure the debug messaging level. More...
 
int getDebugLevel () const
 Returns the configured debug messaging level. More...
 
void setAbortLevel (ELogLevel abortLevel)
 Configure the abort level. More...
 
ELogLevel getAbortLevel () const
 Returns the configured abort level. More...
 
void setLogInfo (ELogLevel logLevel, unsigned int logInfo)
 Configure the printed log information for the given level. More...
 
unsigned int getLogInfo (ELogLevel logLevel) const
 Returns the configured log information for the given level. More...
 

Static Public Member Functions

static const char * logLevelToString (ELogLevel logLevelType)
 Converts a log level type to a string. More...
 

Static Public Attributes

static const int c_DefaultDebugLevel = 10
 Default debug level.
 

Private Attributes

ELogLevel m_logLevel
 The log messaging level. More...
 
int m_debugLevel
 The debug messaging level.
 
ELogLevel m_abortLevel
 The log level at which the execution should be stopped.
 
unsigned int m_logInfo [c_Default]
 The kind of printed information per log level. More...
 

Detailed Description

The LogConfig class.

This class provides configuration settings for the logging system.

Definition at line 32 of file LogConfig.h.

Member Enumeration Documentation

◆ ELogInfo

enum ELogInfo

Definition of the supported log message information.

Enumerator
c_Level 

Log level of the message.


c_Message 

Log message text.


c_Module 

Module in which the message was emitted.

c_Package 

Package in which the message was emitted.

c_Function 

Function in which the message was emitted.

c_File 

Source file in which the message was emitted.

c_Line 

Line in source file in which the message was emitted.

c_Timestamp 

Time at which the message was emitted.

c_NoVariables 

If set don't output any variables that are part of the message.

Definition at line 46 of file LogConfig.h.

79  {return m_logLevel; }

◆ ELogLevel

enum ELogLevel

Definition of the supported log levels.

In ascending order !

Enumerator
c_Debug 

Debug: for code development.


c_Info 

Info: for informational messages, e.g.

about opened files, processed events, etc.

c_Result 

Result: for informational summary messages, e.g.

about number of selected events

c_Warning 

Warning: for potential problems that the user should pay attention to.

c_Error 

Error: for things that went wrong and have to be fixed.

c_Fatal 

Fatal: for situations were the program execution can not be continued.

c_Default 

Default: use globally configured log level.


Definition at line 36 of file LogConfig.h.

Constructor & Destructor Documentation

◆ LogConfig()

LogConfig ( LogConfig::ELogLevel  logLevel = c_Default,
int  debugLevel = c_DefaultDebugLevel 
)

The LogConfig constructor.

Parameters
logLevelThe log level.
debugLevelThe debug level.

Definition at line 19 of file LogConfig.cc.

19  :
20  m_logLevel(logLevel),
21  m_debugLevel(debugLevel),
23  m_logInfo{0}
24 {}

Member Function Documentation

◆ getAbortLevel()

ELogLevel getAbortLevel ( ) const
inline

Returns the configured abort level.

Returns
Returns the configured abort level.

Definition at line 115 of file LogConfig.h.

◆ getDebugLevel()

int getDebugLevel ( ) const
inline

Returns the configured debug messaging level.

Returns
Returns the configured debug messaging level.

Definition at line 101 of file LogConfig.h.

◆ getLogInfo()

unsigned int getLogInfo ( ELogLevel  logLevel) const
inline

Returns the configured log information for the given level.

Returns
Returns the configured log information.

Definition at line 130 of file LogConfig.h.

◆ getLogLevel()

ELogLevel getLogLevel ( ) const
inline

Returns the configured log level.

Returns
Returns the configured log level.

Definition at line 87 of file LogConfig.h.

◆ logLevelToString()

const char * logLevelToString ( LogConfig::ELogLevel  logLevelType)
static

Converts a log level type to a string.

Parameters
logLevelTypeThe type of the log level.
Returns
The string representation of the log level type.

Definition at line 44 of file LogConfig.cc.

◆ setAbortLevel()

void setAbortLevel ( ELogLevel  abortLevel)
inline

Configure the abort level.

Parameters
abortLevelThe abort log level.

Definition at line 108 of file LogConfig.h.

◆ setDebugLevel()

void setDebugLevel ( int  debugLevel)
inline

Configure the debug messaging level.

Parameters
debugLevelThe debug level.

Definition at line 94 of file LogConfig.h.

◆ setLogInfo()

void setLogInfo ( ELogLevel  logLevel,
unsigned int  logInfo 
)
inline

Configure the printed log information for the given level.

Parameters
logLevelThe log level.
logInfoThe log information that should be printed.

Definition at line 123 of file LogConfig.h.

◆ setLogLevel()

void setLogLevel ( ELogLevel  logLevel)

Configure the log level.

Parameters
logLevelThe log level.

Definition at line 27 of file LogConfig.cc.

Member Data Documentation

◆ m_logInfo

unsigned int m_logInfo[c_Default]
private

The kind of printed information per log level.

(ORed combination of LogConfig::ELogInfo flags).

Definition at line 139 of file LogConfig.h.

◆ m_logLevel

ELogLevel m_logLevel
private

The log messaging level.

Defined as int for the parameter handling.

Definition at line 135 of file LogConfig.h.


The documentation for this class was generated from the following files:
Belle2::LogConfig::c_Fatal
@ c_Fatal
Fatal: for situations were the program execution can not be continued.
Definition: LogConfig.h:41
Belle2::LogConfig::m_debugLevel
int m_debugLevel
The debug messaging level.
Definition: LogConfig.h:136
Belle2::LogConfig::m_logLevel
ELogLevel m_logLevel
The log messaging level.
Definition: LogConfig.h:135
Belle2::LogConfig::m_logInfo
unsigned int m_logInfo[c_Default]
The kind of printed information per log level.
Definition: LogConfig.h:139
Belle2::LogConfig::m_abortLevel
ELogLevel m_abortLevel
The log level at which the execution should be stopped.
Definition: LogConfig.h:137