Belle II Software light-2406-ragdoll
LogConfig.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11namespace Belle2 {
22 class LogConfig {
23 public:
24
33 };
34
36 enum ELogInfo { c_Level = 0x01,
37 c_Message = 0x02,
38 c_Module = 0x04,
39 c_Package = 0x08,
40 c_Function = 0x10,
41 c_File = 0x20,
42 c_Line = 0x40,
43 c_Timestamp = 0x80,
44 c_NoVariables = 0x100,
45 };
46
51 };
52
53 static const int c_DefaultDebugLevel = 10;
61 LogConfig(ELogLevel logLevel = c_Default, int debugLevel = c_DefaultDebugLevel);
62
69 static const char* logLevelToString(ELogLevel logLevelType);
70
77 static const char* logRealmToString(ELogRealm realm);
78
84 void setLogLevel(ELogLevel logLevel);
85
91 ELogLevel getLogLevel() const {return m_logLevel; }
92
98 void setDebugLevel(int debugLevel) {m_debugLevel = debugLevel; }
99
105 int getDebugLevel() const {return m_debugLevel; }
106
112 void setAbortLevel(ELogLevel abortLevel) {m_abortLevel = abortLevel; }
113
120
127 void setLogInfo(ELogLevel logLevel, unsigned int logInfo) {m_logInfo[logLevel] = logInfo; }
128
134 unsigned int getLogInfo(ELogLevel logLevel) const {return m_logInfo[logLevel]; }
135
136
137 private:
138
143 unsigned int m_logInfo[c_Default];
144
145 };
146
148} // end namespace Belle2
The LogConfig class.
Definition: LogConfig.h:22
ELogLevel m_abortLevel
The log level at which the execution should be stopped.
Definition: LogConfig.h:141
int m_debugLevel
The debug messaging level.
Definition: LogConfig.h:140
int getDebugLevel() const
Returns the configured debug messaging level.
Definition: LogConfig.h:105
unsigned int m_logInfo[c_Default]
The kind of printed information per log level.
Definition: LogConfig.h:143
ELogLevel m_logLevel
The log messaging level.
Definition: LogConfig.h:139
ELogLevel getLogLevel() const
Returns the configured log level.
Definition: LogConfig.h:91
void setDebugLevel(int debugLevel)
Configure the debug messaging level.
Definition: LogConfig.h:98
static const char * logRealmToString(ELogRealm realm)
Converts a log realm type to a string.
Definition: LogConfig.cc:49
ELogLevel
Definition of the supported log levels.
Definition: LogConfig.h:26
@ c_Error
Error: for things that went wrong and have to be fixed.
Definition: LogConfig.h:30
@ c_Info
Info: for informational messages, e.g.
Definition: LogConfig.h:27
@ c_Debug
Debug: for code development.
Definition: LogConfig.h:26
@ c_Fatal
Fatal: for situations were the program execution can not be continued.
Definition: LogConfig.h:31
@ c_Warning
Warning: for potential problems that the user should pay attention to.
Definition: LogConfig.h:29
@ c_Result
Result: for informational summary messages, e.g.
Definition: LogConfig.h:28
@ c_Default
Default: use globally configured log level.
Definition: LogConfig.h:32
static const int c_DefaultDebugLevel
Default debug level.
Definition: LogConfig.h:53
unsigned int getLogInfo(ELogLevel logLevel) const
Returns the configured log information for the given level.
Definition: LogConfig.h:134
ELogLevel getAbortLevel() const
Returns the configured abort level.
Definition: LogConfig.h:119
void setAbortLevel(ELogLevel abortLevel)
Configure the abort level.
Definition: LogConfig.h:112
ELogRealm
Definition of the supported execution realms.
Definition: LogConfig.h:48
@ c_None
No specific realm.
Definition: LogConfig.h:48
@ c_Online
Online data taking.
Definition: LogConfig.h:49
@ c_Production
Data production jobs.
Definition: LogConfig.h:50
ELogInfo
Definition of the supported log message information.
Definition: LogConfig.h:36
@ c_Module
Module in which the message was emitted.
Definition: LogConfig.h:38
@ c_File
Source file in which the message was emitted.
Definition: LogConfig.h:41
@ c_Function
Function in which the message was emitted.
Definition: LogConfig.h:40
@ c_Line
Line in source file in which the message was emitted.
Definition: LogConfig.h:42
@ c_Level
Log level of the message.
Definition: LogConfig.h:36
@ c_Package
Package in which the message was emitted.
Definition: LogConfig.h:39
@ c_Message
Log message text.
Definition: LogConfig.h:37
@ c_NoVariables
If set don't output any variables that are part of the message.
Definition: LogConfig.h:44
@ c_Timestamp
Time at which the message was emitted.
Definition: LogConfig.h:43
void setLogLevel(ELogLevel logLevel)
Configure the log level.
Definition: LogConfig.cc:25
void setLogInfo(ELogLevel logLevel, unsigned int logInfo)
Configure the printed log information for the given level.
Definition: LogConfig.h:127
static const char * logLevelToString(ELogLevel logLevelType)
Converts a log level type to a string.
Definition: LogConfig.cc:42
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24