11#include <framework/logging/LogConfig.h>
12#include <framework/logging/LogVariableStream.h>
45 std::string function, std::string file,
unsigned int line,
int debugLevel = 0);
59 std::string function, std::string file,
unsigned int line,
int debugLevel = 0);
127 std::ostream&
print(std::ostream& out)
const;
133 std::string
toJSON(
bool complete)
const;
176extern std::ostream& operator<< (std::ostream& out,
const Belle2::LogMessage& logMessage);
ELogLevel
Definition of the supported log levels.
std::string toJSON(bool complete) const
Return a json string for the log message.
int m_debugLevel
The debug level for messages with level=c_Debug.
void setLogInfo(unsigned int logInfo)
Configure which information should be printed.
bool operator!=(const LogMessage &message) const
Check for inequality.
unsigned int m_logInfo
kind of information to show (ORed combination of LogConfig::ELogInfo flags).
const std::vector< LogVar > & getLogVariables() const
Return a reference to the log variables associated with this message.
LogVariableStream m_message
The message stream which should be sent.
const std::string getMessage() const
Returns the message text.
void setCount(int count)
Set the number of occurrences.
unsigned int m_line
The line number in the source code where the message was sent from.
const std::string & getPackage() const
Returns the package where the message was sent from.
std::string m_file
The file name where the message was sent from.
bool operator==(const LogMessage &message) const
Compares two messages.
std::string m_module
The module name where the message was sent from.
LogConfig::ELogLevel getLogLevel() const
Returns the log level of the message.
LogMessage(LogMessage const &lm)=default
Provide copy-constructor.
std::ostream & print(std::ostream &out) const
Generate output stream.
LogMessage & operator=(const LogMessage &lvs)=default
Custom assignment-operator, thanks to stringsream's incompetence ...
std::string m_function
The function name where the message was sent from.
LogConfig::ELogLevel m_logLevel
The log level of the message.
std::string m_package
The package name where the message was sent from.
void setModule(const std::string &module)
Configure which information should be printed.
int m_count
Number of occurrences of the same message.
LogMessage(LogMessage &&)=default
Provide move constructor.
Specialized implementation of an ostream-like class where the << operator can be used to insert value...
const std::vector< LogVar > & getVariables() const
Return the list of all defined variables.
std::string getMessage() const
Return the constant message part without the variables.
std::string str(bool showVariables=true) const
Return the content of the stream as string.
Abstract base class for different kinds of events.
Helper struct to hash and compare messages only by log level and message content.
bool operator()(const LogMessage &lhs, const LogMessage &rhs) const
Check if log level and message text are identical.
std::size_t operator()(const LogMessage &msg) const
Return a hash for the given log message just based on the log level and the message.