![]() |
Belle II Software
light-2303-iriomote
|
The LogMessage class. More...
#include <LogMessage.h>

Classes | |
| struct | TextHasher |
| Helper struct to hash and compare messages only by log level and message content. More... | |
Public Member Functions | |
| LogMessage (LogConfig::ELogLevel logLevel, const std::string &message, const char *package, std::string function, std::string file, unsigned int line, int debugLevel=0) | |
| The LogMessage constructor. More... | |
| LogMessage (LogConfig::ELogLevel logLevel, LogVariableStream &&messageStream, const char *package, std::string function, std::string file, unsigned int line, int debugLevel=0) | |
| The LogMessage constructor taking a LogVariableStream which can contains name/value pairs. More... | |
| LogMessage (LogMessage &&)=default | |
| Provide move constructor. | |
| LogMessage (LogMessage const &lm)=default | |
| Provide copy-constructor. | |
| bool | operator== (const LogMessage &message) const |
| Compares two messages. More... | |
| bool | operator!= (const LogMessage &message) const |
| Check for inequality. | |
| LogMessage & | operator= (const LogMessage &lvs)=default |
| Custom assignment-operator, thanks to stringsream's incompetence ... | |
| LogConfig::ELogLevel | getLogLevel () const |
| Returns the log level of the message. More... | |
| const std::string & | getPackage () const |
| Returns the package where the message was sent from. More... | |
| const std::string | getMessage () const |
| Returns the message text. More... | |
| void | setModule (const std::string &module) |
| Configure which information should be printed. | |
| void | setLogInfo (unsigned int logInfo) |
| Configure which information should be printed. | |
| void | setCount (int count) |
| Set the number of occurrences. | |
| std::ostream & | print (std::ostream &out) const |
| Generate output stream. More... | |
| std::string | toJSON (bool complete) const |
| Return a json string for the log message. More... | |
| const std::vector< LogVar > & | getLogVariables () const |
| Return a reference to the log variables associated with this message. | |
Private Attributes | |
| LogConfig::ELogLevel | m_logLevel |
| The log level of the message. | |
| LogVariableStream | m_message |
| The message stream which should be sent. | |
| std::string | m_module |
| The module name where the message was sent from. | |
| std::string | m_package |
| The package name where the message was sent from. | |
| std::string | m_function |
| The function name where the message was sent from. | |
| std::string | m_file |
| The file name where the message was sent from. | |
| unsigned int | m_line |
| The line number in the source code where the message was sent from. | |
| int | m_debugLevel |
| The debug level for messages with level=c_Debug. | |
| unsigned int | m_logInfo |
| kind of information to show (ORed combination of LogConfig::ELogInfo flags). | |
| int | m_count |
| Number of occurrences of the same message. | |
The LogMessage class.
This class encapsulates a logging message.
Definition at line 29 of file LogMessage.h.
| LogMessage | ( | LogConfig::ELogLevel | logLevel, |
| const std::string & | message, | ||
| const char * | package, | ||
| std::string | function, | ||
| std::string | file, | ||
| unsigned int | line, | ||
| int | debugLevel = 0 |
||
| ) |
The LogMessage constructor.
| logLevel | The log level of the message (e.g. debug, info, warning, error, fatal). |
| message | The message string which should be send. This will be internally converted to a LogVariableStream with the text message and 0 variables. |
| package | The package name where the message was sent from (can be NULL) |
| function | The function name where the message was sent from. |
| file | The file name where the message was sent from. |
| line | The line number in the source code where the message was sent from. |
| debugLevel | The debug level of the message if the logLevel is c_Debug |
Definition at line 25 of file LogMessage.cc.
| LogMessage | ( | LogConfig::ELogLevel | logLevel, |
| LogVariableStream && | messageStream, | ||
| const char * | package, | ||
| std::string | function, | ||
| std::string | file, | ||
| unsigned int | line, | ||
| int | debugLevel = 0 |
||
| ) |
The LogMessage constructor taking a LogVariableStream which can contains name/value pairs.
| logLevel | The log level of the message (e.g. debug, info, warning, error, fatal). |
| messageStream | The LogVariableStream which should be send. |
| package | The package name where the message was sent from (can be NULL) |
| function | The function name where the message was sent from. |
| file | The file name where the message was sent from. |
| line | The line number in the source code where the message was sent from. |
| debugLevel | The debug level of the message if the logLevel is c_Debug |
Definition at line 40 of file LogMessage.cc.
|
inline |
Returns the log level of the message.
Definition at line 91 of file LogMessage.h.
|
inline |
Returns the message text.
Definition at line 105 of file LogMessage.h.
|
inline |
Returns the package where the message was sent from.
Definition at line 98 of file LogMessage.h.
| bool operator== | ( | const LogMessage & | message | ) | const |
Compares two messages.
Definition at line 57 of file LogMessage.cc.
| std::ostream & print | ( | std::ostream & | out | ) | const |
Generate output stream.
| out | The output stream. |
Definition at line 128 of file LogMessage.cc.
| std::string toJSON | ( | bool | complete | ) | const |
Return a json string for the log message.
The returned string will be a json object containing the full log message on one line
| complete | if true include all fields independent of the logInfo settings |
Definition at line 68 of file LogMessage.cc.