Message logger. More...
Public Member Functions | |
void | disable (log::Level=log::Level::LEVEL_CRITICAL) |
void | disableConsole (log::Level=log::Level::LEVEL_CRITICAL) |
void | disableFile (log::Level=log::Level::LEVEL_CRITICAL) |
log::Level | getConsoleVerbosity () |
std::string | getContext () |
log::Level | getDefaultSeverity () |
log::Visibility | getDefaultVisibility () |
log::Level | getFileVerbosity () |
int | getIndentation () |
std::string | getName () const |
log::Priority | getPriority () |
log::Visibility | getVisibility () |
bool | isConsoleTimestampEnabled () const |
bool | isFileTimestampEnabled () const |
void | print (const std::string &message) |
void | print (const std::string &message, log::Level severity) |
void | print (const std::string &message, log::Level severity, log::Visibility visibility) |
void | print (const std::string &message, log::Visibility visibility) |
template<typename T > | |
void | print (const T &value, log::Level severity, log::Visibility visibility) |
void | println (const std::string &message) |
void | println (const std::string &message, const log::Level severity, log::Visibility visibility) |
void | println (const std::string &message, log::Level severity) |
void | println (const std::string &message, log::Visibility visibility) |
void | setConsoleTimestampEnabled (bool enabled) |
void | setConsoleVerbosity (log::Level threshold) |
void | setContext (const std::string &context) |
void | setDefaultSeverity (log::Level severity) |
void | setDefaultVisibility (log::Visibility visibility) |
void | setFileTimestampEnabled (bool enabled) |
void | setFileVerbosity (log::Level threshold) |
void | setIndentation (int delta) |
void | setPriority (log::Priority priority) |
void | setTimestampEnabled (bool enabled) |
void | setVerbosities (log::Level threshold) |
void | setVisibility (log::Visibility visibility) |
Friends | |
class | LoggerManager |
Message logger.
This class implements a message logger. The logger allows to write log messages both on the console and on a log file. The verbosity of the logger can be set for the console and the file independently.
Definition at line 142 of file logger.hpp.
void bitpit::Logger::disable | ( | log::Level | level = log::Level::LEVEL_CRITICAL | ) |
Provides an overriding verbosity level which takes precedence over the logger’s own level.
When the need arises to temporarily throttle logging output down across the whole application, this function can be useful. Its effect is to disable all logging calls of severity level and below, so that if you call it with a value of INFO, then all INFO and DEBUG events would be discarded, whereas those of severity WARNING and above would be processed according to the logger’s effective level.
If the a NOTSET level is specified, it effectively removes this overriding level, so that logging output again depends on the effective verbosity level of the logger.
level | is the overriding verbosity level |
Definition at line 482 of file logger.cpp.
void bitpit::Logger::disableConsole | ( | log::Level | level = log::Level::LEVEL_CRITICAL | ) |
Provides an overriding console verbosity level which takes precedence over the logger’s own level.
When the need arises to temporarily throttle logging output down across the whole application, this function can be useful. Its effect is to disable all logging calls of severity level and below, so that if you call it with a value of INFO, then all INFO and DEBUG events would be discarded, whereas those of severity WARNING and above would be processed according to the logger’s effective level.
If the NOTSET level is specified, it effectively removes this overriding level, so that logging output again depends on the effective verbosity level of the logger.
level | is the overriding verbosity level |
Definition at line 505 of file logger.cpp.
void bitpit::Logger::disableFile | ( | log::Level | level = log::Level::LEVEL_CRITICAL | ) |
Provides an overriding file verbosity level which takes precedence over the logger’s own level.
When the need arises to temporarily throttle logging output down across the whole application, this function can be useful. Its effect is to disable all logging calls of severity level and below, so that if you call it with a value of INFO, then all INFO and DEBUG events would be discarded, whereas those of severity WARNING and above would be processed according to the logger’s effective level.
If the NOTSET level is specified, it effectively removes this overriding level, so that logging output again depends on the effective verbosity level of the logger.
level | is the overriding verbosity level |
Definition at line 527 of file logger.cpp.
log::Level bitpit::Logger::getConsoleVerbosity | ( | ) |
Gets the verbosity threshold for messages printed on the console.
Logging messages which are less severe than the verbosity threshold will be ignored; logging messages which have severity equal to the verbosity threshold or higher will be printed.
Definition at line 726 of file logger.cpp.
std::string bitpit::Logger::getContext | ( | ) |
Gets the context used when printing the messages.
Definition at line 806 of file logger.cpp.
log::Level bitpit::Logger::getDefaultSeverity | ( | ) |
Gets the default severity of the messages.
Definition at line 549 of file logger.cpp.
log::Visibility bitpit::Logger::getDefaultVisibility | ( | ) |
Gets the default visibility of the messages.
Definition at line 591 of file logger.cpp.
log::Level bitpit::Logger::getFileVerbosity | ( | ) |
Gets the verbosity threshold for messages printed on the log file.
Logging messages which are less severe than the verbosity threshold will be ignored; logging messages which have severity equal to the verbosity threshold or higher will be printed.
Definition at line 780 of file logger.cpp.
int bitpit::Logger::getIndentation | ( | ) |
Gets the indentation level used when printing the messages.
Definition at line 832 of file logger.cpp.
std::string bitpit::Logger::getName | ( | ) | const |
Gets the name of the logger
Definition at line 842 of file logger.cpp.
log::Priority bitpit::Logger::getPriority | ( | ) |
Gets the current priority of the messages.
Definition at line 569 of file logger.cpp.
log::Visibility bitpit::Logger::getVisibility | ( | ) |
Gets the visibility of the messages.
Definition at line 611 of file logger.cpp.
bool bitpit::Logger::isConsoleTimestampEnabled | ( | ) | const |
Returns true if the timestamp is enabled on the console, false otherwise.
Definition at line 650 of file logger.cpp.
bool bitpit::Logger::isFileTimestampEnabled | ( | ) | const |
Returns true if the timestamp is enabled on the log file, false otherwise.
Definition at line 737 of file logger.cpp.
void bitpit::Logger::print | ( | const std::string & | message | ) |
Prints a message in the log.
message | is the message to be printed |
Definition at line 896 of file logger.cpp.
void bitpit::Logger::print | ( | const std::string & | message, |
log::Level | severity ) |
Prints a message in the log.
message | is the message to be printed |
severity | is the severity of the line that will be printed |
Definition at line 907 of file logger.cpp.
void bitpit::Logger::print | ( | const std::string & | message, |
log::Level | severity, | ||
log::Visibility | visibility ) |
Prints a message in the log.
message | is the message to be printed |
severity | is the severity of the line to be printed |
visibility | is the visibility of the line that will be printed |
Definition at line 930 of file logger.cpp.
void bitpit::Logger::print | ( | const std::string & | message, |
log::Visibility | visibility ) |
Prints a message in the log.
message | is the message to be printed |
visibility | is the visibility of the line that will be printed |
Definition at line 918 of file logger.cpp.
|
inline |
Definition at line 196 of file logger.hpp.
void bitpit::Logger::println | ( | const std::string & | line | ) |
Prints a line in the log.
line | is the line to be printed |
Definition at line 852 of file logger.cpp.
void bitpit::Logger::println | ( | const std::string & | line, |
const log::Level | severity, | ||
log::Visibility | visibility ) |
Prints a line in the log.
line | is the line to be printed |
severity | is the severity of the line that will be printed |
visibility | is the visibility of the line that will be printed |
Definition at line 886 of file logger.cpp.
void bitpit::Logger::println | ( | const std::string & | line, |
log::Level | severity ) |
Prints a line in the log.
line | is the line to be printed |
severity | is the severity of the line that will be printed |
Definition at line 863 of file logger.cpp.
void bitpit::Logger::println | ( | const std::string & | line, |
log::Visibility | visibility ) |
Prints a line in the log.
line | is the line to be printed |
visibility | is the visibility of the line that will be printed |
Definition at line 874 of file logger.cpp.
void bitpit::Logger::setConsoleTimestampEnabled | ( | bool | enabled | ) |
Enables the timestamp on the console.
enabled | if set to true enables the timestamp on the console. |
Definition at line 660 of file logger.cpp.
void bitpit::Logger::setConsoleVerbosity | ( | log::Level | threshold | ) |
Sets the verbosity threshold for messages printed on the console.
Logging messages which are less severe than the verbosity threshold will be ignored; logging messages which have severity equal to the verbosity threshold or higher will be printed.
threshold | is the verbosity threshold |
Definition at line 680 of file logger.cpp.
void bitpit::Logger::setContext | ( | const std::string & | context | ) |
Sets the context used when printing the messages.
context | is the context used when printing the messages. |
Definition at line 790 of file logger.cpp.
void bitpit::Logger::setDefaultSeverity | ( | log::Level | severity | ) |
Sets the default severity of the messages.
severity | is the default severity of the messages |
Definition at line 537 of file logger.cpp.
void bitpit::Logger::setDefaultVisibility | ( | log::Visibility | visibility | ) |
Sets the default visibility of the messages.
visibility | is the default visibility of the messages |
Definition at line 579 of file logger.cpp.
void bitpit::Logger::setFileTimestampEnabled | ( | bool | enabled | ) |
Enables the timestamp on the log file.
enabled | if set to true enables the timestamp on the log file |
Definition at line 747 of file logger.cpp.
void bitpit::Logger::setFileVerbosity | ( | log::Level | threshold | ) |
Sets the verbosity threshold for messages printed on the log file.
Logging messages which are less severe than the verbosity threshold will be ignored; logging messages which have severity equal to the verbosity threshold or higher will be printed.
threshold | is the verbosity threshold |
Definition at line 767 of file logger.cpp.
void bitpit::Logger::setIndentation | ( | int | delta | ) |
Sets the indentation level used when printing the messages.
delta | is the relative indentation level |
Definition at line 816 of file logger.cpp.
void bitpit::Logger::setPriority | ( | log::Priority | priority | ) |
Sets the default priority of the messages.
priority | is the default priority of the messages |
Definition at line 559 of file logger.cpp.
void bitpit::Logger::setTimestampEnabled | ( | bool | enabled | ) |
Enables the timestamp both on the console and on the log file.
enabled | if set to true enables the timestamp both on the console and on the log file. |
Definition at line 638 of file logger.cpp.
void bitpit::Logger::setVerbosities | ( | log::Level | threshold | ) |
Sets the verbosity threshold for messages printed on the console and on the log file.
Logging messages which are less severe than the verbosity threshold will be ignored; logging messages which have severity equal to the verbosity threshold or higher will be printed.
threshold | is the verbosity threshold |
Definition at line 626 of file logger.cpp.
void bitpit::Logger::setVisibility | ( | log::Visibility | visibility | ) |
Sets the visibility of the messages.
visibility | is the default visibility of the messages |
Definition at line 601 of file logger.cpp.
|
friend |
Definition at line 145 of file logger.hpp.