Belle II Software light-2406-ragdoll
LogSystem Class Reference

Class for logging debug, info and error messages. More...

#include <LogSystem.h>

Collaboration diagram for LogSystem:

Public Member Functions

void addLogConnection (LogConnectionBase *logConnection)
 Adds a log connection object which is used to the send the logging messages.
 
void resetLogConnections ()
 Removes all log connections.
 
void resetLogging ()
 Reset logging system to defaults: empty all log messages and reset connections to the default.
 
LogConfiggetLogConfig ()
 Returns global log system configuration.
 
void addPackageLogConfig (const std::string &package, const LogConfig &logConfig)
 Add the per package log configuration.
 
LogConfiggetPackageLogConfig (const std::string &package)
 Get the log configuration for the package with the given name.
 
bool isLevelEnabled (LogConfig::ELogLevel level, int debugLevel=0, const char *package=nullptr) const
 Returns true if the given log level is allowed by the log system (i.e.
 
bool sendMessage (LogMessage &&message)
 Sends a log message using the log connection object.
 
void resetMessageCounter ()
 Resets the message counter and error log by setting all message counts to 0.
 
int getMessageCounter (LogConfig::ELogLevel logLevel) const
 Returns the number of logging calls per log level.
 
const LogConfiggetCurrentLogConfig (const char *package=nullptr) const
 Returns the current LogConfig object used by the logging system.
 
LogConfig::ELogLevel getCurrentLogLevel (const char *package=nullptr) const
 Returns the current log level used by the logging system.
 
int getCurrentDebugLevel (const char *package=nullptr) const
 Returns the current debug level used by the logging system.
 
unsigned getMaxMessageRepetitions () const
 Get maximum number of repetitions before silencing "identical" log messages.
 
void setMaxMessageRepetitions (unsigned repetitions)
 Set maximum number of repetitions before silencing "identical" log messages.
 
void printErrorSummary ()
 Print error/warning summary at end of execution.
 
void enableErrorSummary (bool on)
 enable/disable error/warning summary after successful execution and B2FATAL.
 
void updateModule (const LogConfig *moduleLogConfig=nullptr, const std::string &moduleName="")
 Sets the log configuration to the given module log configuration and sets the module name This method should only be called by the EventProcessor.
 

Static Public Member Functions

static LogSystemInstance ()
 Static method to get a reference to the LogSystem instance.
 
static void enableDebug ()
 Enable debug output.
 
static bool debugEnabled ()
 Is debug output enabled?
 

Static Public Attributes

static const unsigned int c_errorSummaryMaxLines = 10000
 Error log will contain at most this many lines.
 

Private Member Functions

 LogSystem ()
 The constructor is hidden to avoid that someone creates an instance of this class.
 
 LogSystem (const LogSystem &)=delete
 Disable/Hide the copy constructor.
 
LogSystemoperator= (const LogSystem &)=delete
 Disable/Hide the copy assignment operator.
 
 ~LogSystem ()
 The LogSystem destructor.
 
void incMessageCounter (LogConfig::ELogLevel logLevel)
 Increases the counter for the called message level by one.
 
bool deliverMessageToConnections (const LogMessage &msg)
 Do nothing else than to send the message to all connected connections.
 
void showText (LogConfig::ELogLevel level, const std::string &txt, int info=LogConfig::c_Message)
 Send a custom message which looks like a log message but should not be counted as such.
 

Private Attributes

std::vector< LogConnectionBase * > m_logConnections
 Stores the pointers to the log connection objects.
 
LogConfig m_logConfig
 The global log system configuration.
 
const LogConfigm_moduleLogConfig
 log config of current module
 
std::string m_moduleName
 The current module name.
 
std::map< std::string, LogConfigm_packageLogConfigs
 Stores the log configuration objects for packages.
 
bool m_printErrorSummary
 Wether to re-print errors-warnings encountered during execution at the end.
 
std::unordered_map< LogMessage, int, LogMessage::TextHasher, LogMessage::TextHasherm_messageLog {100}
 Count of previous log messages for the summary and to suppress repetitive messages.
 
unsigned int m_maxErrorRepetition {0}
 Maximum number to show the same message.
 
unsigned int m_suppressedMessages {0}
 The amount of messages we have suppressed so far just to get an indication we print this from time to time.
 
int m_messageCounter [LogConfig::c_Default]
 Counts the number of messages sent per message level.
 

Static Private Attributes

static bool s_debugEnabled = false
 Global flag for fast checking if debug output is enabled.
 

Detailed Description

Class for logging debug, info and error messages.

For log messages the following preprocessor macros should be used: B2DEBUG for code development B2INFO for informational messages, e.g. about opened files, processed events, etc. B2RESULT for informational summary messages, e.g. about number of selected events B2WARNING for potential problems that the user should pay attention to B2ERROR for things that went wrong and have to be fixed B2FATAL for situations were the program execution can not be continued

By default the Logger sends messages to std::cout.

Using preprocessor macros has two advantages.

  • the log statements can be removed from the code completely by redefining the macros.
  • they allow to add information about the location (package, function, file, line).

This class is designed as a singleton.

Definition at line 46 of file LogSystem.h.

Constructor & Destructor Documentation

◆ LogSystem()

LogSystem ( )
private

The constructor is hidden to avoid that someone creates an instance of this class.

Definition at line 171 of file LogSystem.cc.

171 :
173 m_moduleLogConfig(nullptr),
174 m_printErrorSummary(false),
176{
177 resetLogging();
178}
@ c_Info
Info: for informational messages, e.g.
Definition: LogConfig.h:27
void resetLogging()
Reset logging system to defaults: empty all log messages and reset connections to the default.
Definition: LogSystem.cc:180
int m_messageCounter[LogConfig::c_Default]
Counts the number of messages sent per message level.
Definition: LogSystem.h:223
bool m_printErrorSummary
Wether to re-print errors-warnings encountered during execution at the end.
Definition: LogSystem.h:215
LogConfig m_logConfig
The global log system configuration.
Definition: LogSystem.h:207
const LogConfig * m_moduleLogConfig
log config of current module
Definition: LogSystem.h:209

◆ ~LogSystem()

~LogSystem ( )
private

The LogSystem destructor.

Definition at line 292 of file LogSystem.cc.

293{
295}
void resetLogConnections()
Removes all log connections.
Definition: LogSystem.cc:44

Member Function Documentation

◆ addLogConnection()

void addLogConnection ( LogConnectionBase logConnection)

Adds a log connection object which is used to the send the logging messages.

Note
The LogSystem class takes ownership of the log connection object.
Parameters
logConnectionPointer to the logging connection object. The LogSystem takes ownership of this object.

Definition at line 38 of file LogSystem.cc.

39{
40 m_logConnections.push_back(logConnection);
41}
std::vector< LogConnectionBase * > m_logConnections
Stores the pointers to the log connection objects.
Definition: LogSystem.h:205

◆ addPackageLogConfig()

void addPackageLogConfig ( const std::string &  package,
const LogConfig logConfig 
)
inline

Add the per package log configuration.

Adds a new log configuration for the given package name.

Parameters
packageThe name of the package whose log configuration should be added.
logConfigThe log configuration which should be assigned to the given package.

Definition at line 87 of file LogSystem.h.

87{ m_packageLogConfigs[package] = logConfig; }
std::map< std::string, LogConfig > m_packageLogConfigs
Stores the log configuration objects for packages.
Definition: LogSystem.h:213

◆ debugEnabled()

static bool debugEnabled ( )
inlinestatic

Is debug output enabled?

Definition at line 201 of file LogSystem.h.

201{return s_debugEnabled;}
static bool s_debugEnabled
Global flag for fast checking if debug output is enabled.
Definition: LogSystem.h:225

◆ deliverMessageToConnections()

bool deliverMessageToConnections ( const LogMessage msg)
private

Do nothing else than to send the message to all connected connections.

No bookkeeping, just and and be done

Definition at line 53 of file LogSystem.cc.

54{
55 bool messageSent = false;
56 for (auto con : m_logConnections) {
57 messageSent |= con->sendMessage(message);
58 }
59 return messageSent;
60}

◆ enableDebug()

static void enableDebug ( )
inlinestatic

Enable debug output.

Definition at line 196 of file LogSystem.h.

196{s_debugEnabled = true;}

◆ enableErrorSummary()

void enableErrorSummary ( bool  on)
inline

enable/disable error/warning summary after successful execution and B2FATAL.

During normal basf2 execution, this is turned on by the Framework object. For unit tests (i.e. without a Framework object), the default is used instead (off).

Definition at line 181 of file LogSystem.h.

181{ m_printErrorSummary = on; }

◆ getCurrentDebugLevel()

int getCurrentDebugLevel ( const char *  package = nullptr) const
inline

Returns the current debug level used by the logging system.

See also
getCurrentLogConfig()

Definition at line 153 of file LogSystem.h.

153{ return getCurrentLogConfig(package).getDebugLevel(); }
int getDebugLevel() const
Returns the configured debug messaging level.
Definition: LogConfig.h:105
const LogConfig & getCurrentLogConfig(const char *package=nullptr) const
Returns the current LogConfig object used by the logging system.
Definition: LogSystem.h:258

◆ getCurrentLogLevel()

LogConfig::ELogLevel getCurrentLogLevel ( const char *  package = nullptr) const
inline

Returns the current log level used by the logging system.

See also
getCurrentLogConfig()

Definition at line 146 of file LogSystem.h.

146{ return getCurrentLogConfig(package).getLogLevel(); }
ELogLevel getLogLevel() const
Returns the configured log level.
Definition: LogConfig.h:91

◆ getLogConfig()

LogConfig * getLogConfig ( )
inline

Returns global log system configuration.

Definition at line 78 of file LogSystem.h.

78{return &m_logConfig;}

◆ getMaxMessageRepetitions()

unsigned getMaxMessageRepetitions ( ) const
inline

Get maximum number of repetitions before silencing "identical" log messages.

Identity only checks for log level and message content (excluding variables)

Definition at line 160 of file LogSystem.h.

160{ return m_maxErrorRepetition; }
unsigned int m_maxErrorRepetition
Maximum number to show the same message.
Definition: LogSystem.h:219

◆ getMessageCounter()

int getMessageCounter ( LogConfig::ELogLevel  logLevel) const

Returns the number of logging calls per log level.

Parameters
logLevelThe logging level which should be returned.
Returns
The number of message calls for the given log level.

Definition at line 161 of file LogSystem.cc.

162{
163 return m_messageCounter[logLevel];
164}

◆ getPackageLogConfig()

LogConfig & getPackageLogConfig ( const std::string &  package)
inline

Get the log configuration for the package with the given name.

If no package specific configuration exists a new one is created.

Parameters
packageThe name of the package whose log configuration should be returned
Returns
The log configuration of the given package

Definition at line 96 of file LogSystem.h.

96{ return m_packageLogConfigs[package]; }

◆ incMessageCounter()

void incMessageCounter ( LogConfig::ELogLevel  logLevel)
private

Increases the counter for the called message level by one.

Parameters
logLevelThe logging level which should be increased by one.

Definition at line 297 of file LogSystem.cc.

298{
299 m_messageCounter[logLevel]++;
300}

◆ Instance()

LogSystem & Instance ( )
static

Static method to get a reference to the LogSystem instance.

Returns
A reference to an instance of this class.

Definition at line 31 of file LogSystem.cc.

32{
33 static LogSystem instance;
34 return instance;
35}
Class for logging debug, info and error messages.
Definition: LogSystem.h:46

◆ printErrorSummary()

void printErrorSummary ( )

Print error/warning summary at end of execution.

Does nothing if m_printErrorSummary is false.

Definition at line 206 of file LogSystem.cc.

207{
209 return; //disabled
210
211 int numLogWarn = getMessageCounter(LogConfig::c_Warning);
212 int numLogError = getMessageCounter(LogConfig::c_Error);
213
214 // ok, only errors and warnings in the error summary
215 std::vector<std::pair<LogMessage, unsigned int>> messages;
216 for (auto&& value : m_messageLog) {
217 if (value.first.getLogLevel() < LogConfig::c_Warning) continue;
218 messages.emplace_back(std::move(value));
219 }
220 // but show them sorted by severity and occurrence
221 std::stable_sort(messages.begin(), messages.end(), [](const auto & a, const auto & b) {
222 return a.first.getLogLevel() > b.first.getLogLevel() or
223 (a.first.getLogLevel() == b.first.getLogLevel() and a.second > b.second);
224 });
225 if (messages.size() == 0) {
226 return; //nothing to do
227 }
228
229 // save configuration
230 const LogConfig oldConfig = m_logConfig;
231 // and make sure module configuration is bypassed, otherwise changing the settings in m_logConfig would be ignored
232 const LogConfig* oldModuleConfig {nullptr};
233 std::swap(m_moduleLogConfig, oldModuleConfig);
234 // similar for package configuration
235 map<string, LogConfig> oldPackageConfig;
236 std::swap(m_packageLogConfigs, oldPackageConfig);
237 // prevent calling printErrorSummary() again when printing
239
240 // only show level & message
243 logInfo |= LogConfig::c_Module;
248
249 // and then show all the messages
250 showText(LogConfig::c_Info, "===Error Summary================================================================",
252 for (auto & [msg, count] : messages) {
253 const bool multiple = count > 1;
254 // don't show variables if the message appeared more than once, could have different values/variables
255 msg.setLogInfo(m_logConfig.getLogInfo(msg.getLogLevel()) | (multiple ? LogConfig::c_NoVariables : 0));
256 // and directly print the message as it was saved.
258 // and also tell us the count
259 if (multiple) {
260 showText(LogConfig::c_Info, " (last message occurred " + std::to_string(count) + " times)");
261 }
262 }
263 showText(LogConfig::c_Info, "================================================================================",
265 if (numLogError) {
266 showText(LogConfig::c_Error, "in total, " + std::to_string(numLogError) + " errors occurred during processing",
268 }
269 if (numLogWarn) {
270 showText(LogConfig::c_Warning, "in total, " + std::to_string(numLogWarn) + " warnings occurred during processing",
272 }
273 if (m_messageLog.size() == c_errorSummaryMaxLines) {
274 showText(LogConfig::c_Warning, "Note: The error summary was truncated to " +
275 std::to_string(c_errorSummaryMaxLines) + " (distinct) messages",
277 }
279 showText(LogConfig::c_Warning, std::to_string(m_suppressedMessages) + " log messages were suppressed",
281 }
282
283 // and then clear the log
284 m_messageLog.clear();
285
286 // restore old configuration
287 m_logConfig = oldConfig;
288 std::swap(m_moduleLogConfig, oldModuleConfig);
289 std::swap(m_packageLogConfigs, oldPackageConfig);
290}
The LogConfig class.
Definition: LogConfig.h:22
@ c_Error
Error: for things that went wrong and have to be fixed.
Definition: LogConfig.h:30
@ 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_Default
Default: use globally configured log level.
Definition: LogConfig.h:32
unsigned int getLogInfo(ELogLevel logLevel) const
Returns the configured log information for the given level.
Definition: LogConfig.h:134
void setAbortLevel(ELogLevel abortLevel)
Configure the abort level.
Definition: LogConfig.h:112
@ c_Module
Module in which the message was emitted.
Definition: LogConfig.h:38
@ c_Level
Log level of the message.
Definition: LogConfig.h:36
@ 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
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
unsigned int m_suppressedMessages
The amount of messages we have suppressed so far just to get an indication we print this from time to...
Definition: LogSystem.h:221
bool deliverMessageToConnections(const LogMessage &msg)
Do nothing else than to send the message to all connected connections.
Definition: LogSystem.cc:53
std::unordered_map< LogMessage, int, LogMessage::TextHasher, LogMessage::TextHasher > m_messageLog
Count of previous log messages for the summary and to suppress repetitive messages.
Definition: LogSystem.h:217
int getMessageCounter(LogConfig::ELogLevel logLevel) const
Returns the number of logging calls per log level.
Definition: LogSystem.cc:161
static const unsigned int c_errorSummaryMaxLines
Error log will contain at most this many lines.
Definition: LogSystem.h:48
void showText(LogConfig::ELogLevel level, const std::string &txt, int info=LogConfig::c_Message)
Send a custom message which looks like a log message but should not be counted as such.
Definition: LogSystem.cc:62

◆ resetLogConnections()

void resetLogConnections ( )

Removes all log connections.

Definition at line 44 of file LogSystem.cc.

45{
46 for (auto connection : m_logConnections) {
47 delete connection;
48 }
49 m_logConnections.clear();
50}

◆ resetLogging()

void resetLogging ( )

Reset logging system to defaults: empty all log messages and reset connections to the default.

Definition at line 180 of file LogSystem.cc.

181{
184 m_moduleLogConfig = nullptr;
185 m_packageLogConfigs.clear();
186 constexpr unsigned int logInfo = LogConfig::c_Level + LogConfig::c_Message;
187 constexpr unsigned int warnLogInfo = LogConfig::c_Level + LogConfig::c_Message + LogConfig::c_Module;
188 constexpr unsigned int debugLogInfo = LogConfig::c_Level + LogConfig::c_Message + LogConfig::c_Module + LogConfig::c_File +
190 constexpr unsigned int fatalLogInfo = LogConfig::c_Level + LogConfig::c_Message + LogConfig::c_Module + LogConfig::c_Function;
197
201
202 m_printErrorSummary = false;
203 s_debugEnabled = false;
204}
void setDebugLevel(int debugLevel)
Configure the debug messaging level.
Definition: LogConfig.h:98
@ c_Debug
Debug: for code development.
Definition: LogConfig.h:26
@ c_Result
Result: for informational summary messages, e.g.
Definition: LogConfig.h:28
static const int c_DefaultDebugLevel
Default debug level.
Definition: LogConfig.h:53
@ 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
Implements a log connection to an IO Stream.
Implements a log connection that filters repeated messages.
void resetMessageCounter()
Resets the message counter and error log by setting all message counts to 0.
Definition: LogSystem.cc:150
void addLogConnection(LogConnectionBase *logConnection)
Adds a log connection object which is used to the send the logging messages.
Definition: LogSystem.cc:38

◆ resetMessageCounter()

void resetMessageCounter ( )

Resets the message counter and error log by setting all message counts to 0.

Definition at line 150 of file LogSystem.cc.

151{
152 for (int& i : m_messageCounter) {
153 i = 0;
154 }
156 m_messageLog.clear();
157 m_messageLog.reserve(100);
158}

◆ sendMessage()

bool sendMessage ( LogMessage &&  message)

Sends a log message using the log connection object.

This method should only be called by the logger macros.

Parameters
messageThe log message object. The message might be moved into internal storage and is not valid any more after the method call.
Returns
Returns true if the message could be send.

Definition at line 69 of file LogSystem.cc.

70{
71 LogConfig::ELogLevel logLevel = message.getLogLevel();
72 auto packageLogConfig = m_packageLogConfigs.find(message.getPackage());
73 if ((packageLogConfig != m_packageLogConfigs.end()) && packageLogConfig->second.getLogInfo(logLevel)) {
74 message.setLogInfo(packageLogConfig->second.getLogInfo(logLevel));
75 } else if (m_moduleLogConfig && m_moduleLogConfig->getLogInfo(logLevel)) {
76 message.setLogInfo(m_moduleLogConfig->getLogInfo(logLevel));
77 } else {
78 message.setLogInfo(m_logConfig.getLogInfo(logLevel));
79 }
80
81 message.setModule(m_moduleName);
82
83 // We want to count it whether we've seen it or not
84 incMessageCounter(logLevel);
85
86 // add message to list of message or increase repetition value
87 bool lastTime(false);
88 unsigned int repetition{0};
90 // we already have maximum size of the error log so don't add more messages.
91 // but we might want to increase the counter if it already exists
92 if (auto it = m_messageLog.find(message); it != m_messageLog.end()) {
93 repetition = ++(it->second);
94 }
95 } else if (logLevel >= LogConfig::c_Warning or m_maxErrorRepetition > 0) {
96 // otherwise we only keep warnings or higher unless we suppress repetitions,
97 // then we keep everything
98 repetition = ++m_messageLog[message];
99 message.setCount(repetition);
100 }
101 lastTime = m_maxErrorRepetition > 0 and repetition == m_maxErrorRepetition;
102 if (m_maxErrorRepetition > 0 and repetition > m_maxErrorRepetition) {
103 // We've seen this message more than once before so it cannot be an abort
104 // level message. So we can just not do anything here except counting ...
106 // However we should warn from time to time that messages are being
107 // suppressed ... but not too often otherwise we don't gain anything so
108 // let's warn first each 100, then each 1000 suppressed messages.
109 if ((m_suppressedMessages < 1000 and m_suppressedMessages % 100 == 0) or
110 (m_suppressedMessages < 10000 and m_suppressedMessages % 1000 == 0) or
111 (m_suppressedMessages % 10000 == 0)) {
112 showText(LogConfig::c_Warning, "... " + std::to_string(m_suppressedMessages) + " log messages suppressed due to repetition ...");
113 }
114 return true;
115 }
116
117 // Ok we want to see the message
118 bool messageSent = deliverMessageToConnections(message);
119
120 if (logLevel >= m_logConfig.getAbortLevel()) {
122 // make sure loc connections are finalized to not loose output
123 for (auto connection : m_logConnections) {
124 connection->finalizeOnAbort();
125 }
126 DataStore::Instance().reset(); // ensure we are executed before ROOT's exit handlers
127
128 //in good tradition, ROOT signal handlers are unsafe.
129 //this avoids a problem seen in ROOT's atexit() handler, which might crash
130 //and then deadlock the process in the SIGSEGV handler...
131 signal(SIGSEGV, nullptr);
132
133 //ROOT will also try to do this, but doesn't get the order right.
134 gROOT->CloseFiles();
135 exit(1);
136 }
137
138 // And if it is the last time we show it let's add a trailer for good measure
139 if (messageSent and lastTime) {
140 showText(max(message.getLogLevel(), LogConfig::c_Warning),
141 "The previous message has occurred " + std::to_string(m_maxErrorRepetition) +
142 " times and will be suppressed in future",
144 }
145
146 return messageSent;
147}
static DataStore & Instance()
Instance of singleton Store.
Definition: DataStore.cc:54
void reset(EDurability durability)
Frees memory occupied by data store items and removes all objects from the map.
Definition: DataStore.cc:86
ELogLevel
Definition of the supported log levels.
Definition: LogConfig.h:26
ELogLevel getAbortLevel() const
Returns the configured abort level.
Definition: LogConfig.h:119
void printErrorSummary()
Print error/warning summary at end of execution.
Definition: LogSystem.cc:206
void incMessageCounter(LogConfig::ELogLevel logLevel)
Increases the counter for the called message level by one.
Definition: LogSystem.cc:297
std::string m_moduleName
The current module name.
Definition: LogSystem.h:211

◆ setMaxMessageRepetitions()

void setMaxMessageRepetitions ( unsigned  repetitions)
inline

Set maximum number of repetitions before silencing "identical" log messages.

Identity only checks for log level and message content (excluding variables)

Definition at line 167 of file LogSystem.h.

167{ m_maxErrorRepetition = repetitions; }

◆ showText()

void showText ( LogConfig::ELogLevel  level,
const std::string &  txt,
int  info = LogConfig::c_Message 
)
private

Send a custom message which looks like a log message but should not be counted as such.

This is used in a few places to emit descriptive messages related to other messages without danger of being suppressed

Definition at line 62 of file LogSystem.cc.

63{
64 LogMessage customText(level, txt, "", "", "", 0);
65 customText.setLogInfo(info);
67}
The LogMessage class.
Definition: LogMessage.h:29

◆ updateModule()

void updateModule ( const LogConfig moduleLogConfig = nullptr,
const std::string &  moduleName = "" 
)
inline

Sets the log configuration to the given module log configuration and sets the module name This method should only be called by the EventProcessor.

Parameters
moduleLogConfigPointer to the logging configuration object of the module. Set to NULL to use the global log configuration.
moduleNameName of the module.

Definition at line 191 of file LogSystem.h.

191{ m_moduleLogConfig = moduleLogConfig; m_moduleName = moduleName; }

Member Data Documentation

◆ c_errorSummaryMaxLines

const unsigned int c_errorSummaryMaxLines = 10000
static

Error log will contain at most this many lines.

Definition at line 48 of file LogSystem.h.

◆ m_logConfig

LogConfig m_logConfig
private

The global log system configuration.

Definition at line 207 of file LogSystem.h.

◆ m_logConnections

std::vector<LogConnectionBase*> m_logConnections
private

Stores the pointers to the log connection objects.

(owned by us)

Definition at line 205 of file LogSystem.h.

◆ m_maxErrorRepetition

unsigned int m_maxErrorRepetition {0}
private

Maximum number to show the same message.

If zero we don't suppress repeated messages

Definition at line 219 of file LogSystem.h.

◆ m_messageCounter

int m_messageCounter[LogConfig::c_Default]
private

Counts the number of messages sent per message level.

Definition at line 223 of file LogSystem.h.

◆ m_messageLog

std::unordered_map<LogMessage, int, LogMessage::TextHasher, LogMessage::TextHasher> m_messageLog {100}
private

Count of previous log messages for the summary and to suppress repetitive messages.

Definition at line 217 of file LogSystem.h.

◆ m_moduleLogConfig

const LogConfig* m_moduleLogConfig
private

log config of current module

Definition at line 209 of file LogSystem.h.

◆ m_moduleName

std::string m_moduleName
private

The current module name.

Definition at line 211 of file LogSystem.h.

◆ m_packageLogConfigs

std::map<std::string, LogConfig> m_packageLogConfigs
private

Stores the log configuration objects for packages.

Definition at line 213 of file LogSystem.h.

◆ m_printErrorSummary

bool m_printErrorSummary
private

Wether to re-print errors-warnings encountered during execution at the end.

Definition at line 215 of file LogSystem.h.

◆ m_suppressedMessages

unsigned int m_suppressedMessages {0}
private

The amount of messages we have suppressed so far just to get an indication we print this from time to time.

Definition at line 221 of file LogSystem.h.

◆ s_debugEnabled

bool s_debugEnabled = false
staticprivate

Global flag for fast checking if debug output is enabled.

Definition at line 225 of file LogSystem.h.


The documentation for this class was generated from the following files: