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 |
Detailed Description
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.
Member Function Documentation
◆ disable()
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.
- Parameters
-
level is the overriding verbosity level
Definition at line 491 of file logger.cpp.
◆ disableConsole()
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.
- Parameters
-
level is the overriding verbosity level
Definition at line 514 of file logger.cpp.
◆ disableFile()
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.
- Parameters
-
level is the overriding verbosity level
Definition at line 536 of file logger.cpp.
◆ getConsoleVerbosity()
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.
- Returns
- The verbosity for the messages printed on the console.
Definition at line 735 of file logger.cpp.
◆ getContext()
std::string bitpit::Logger::getContext | ( | ) |
Gets the context used when printing the messages.
- Returns
- The the context used when printing the messages.
Definition at line 815 of file logger.cpp.
◆ getDefaultSeverity()
log::Level bitpit::Logger::getDefaultSeverity | ( | ) |
Gets the default severity of the messages.
- Returns
- The gets the default severity of the messages.
Definition at line 558 of file logger.cpp.
◆ getDefaultVisibility()
log::Visibility bitpit::Logger::getDefaultVisibility | ( | ) |
Gets the default visibility of the messages.
- Returns
- The gets the visibility of the messages.
Definition at line 600 of file logger.cpp.
◆ getFileVerbosity()
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 789 of file logger.cpp.
◆ getIndentation()
int bitpit::Logger::getIndentation | ( | ) |
Gets the indentation level used when printing the messages.
- Returns
- The the indentation level used when printing the messages.
Definition at line 841 of file logger.cpp.
◆ getName()
std::string bitpit::Logger::getName | ( | ) | const |
Gets the name of the logger
- Returns
- The name of the logger.
Definition at line 851 of file logger.cpp.
◆ getPriority()
log::Priority bitpit::Logger::getPriority | ( | ) |
Gets the current priority of the messages.
- Returns
- The gets the current priority of the messages.
Definition at line 578 of file logger.cpp.
◆ getVisibility()
log::Visibility bitpit::Logger::getVisibility | ( | ) |
Gets the visibility of the messages.
- Returns
- The gets the visibility of the messages.
Definition at line 620 of file logger.cpp.
◆ isConsoleTimestampEnabled()
bool bitpit::Logger::isConsoleTimestampEnabled | ( | ) | const |
Returns true if the timestamp is enabled on the console, false otherwise.
- Returns
- Returns true if the timestamp is enabled on the console, false otherwise.
Definition at line 659 of file logger.cpp.
◆ isFileTimestampEnabled()
bool bitpit::Logger::isFileTimestampEnabled | ( | ) | const |
Returns true if the timestamp is enabled on the log file, false otherwise.
- Returns
- Returns true if the timestamp is enabled on the log file, false otherwise.
Definition at line 746 of file logger.cpp.
◆ print() [1/5]
void bitpit::Logger::print | ( | const std::string & | message | ) |
Prints a message in the log.
- Parameters
-
message is the message to be printed
Definition at line 905 of file logger.cpp.
◆ print() [2/5]
void bitpit::Logger::print | ( | const std::string & | message, |
log::Level | severity ) |
Prints a message in the log.
- Parameters
-
message is the message to be printed severity is the severity of the line that will be printed
Definition at line 916 of file logger.cpp.
◆ print() [3/5]
void bitpit::Logger::print | ( | const std::string & | message, |
log::Level | severity, | ||
log::Visibility | visibility ) |
Prints a message in the log.
- Parameters
-
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 939 of file logger.cpp.
◆ print() [4/5]
void bitpit::Logger::print | ( | const std::string & | message, |
log::Visibility | visibility ) |
Prints a message in the log.
- Parameters
-
message is the message to be printed visibility is the visibility of the line that will be printed
Definition at line 927 of file logger.cpp.
◆ print() [5/5]
|
inline |
Definition at line 196 of file logger.hpp.
◆ println() [1/4]
void bitpit::Logger::println | ( | const std::string & | line | ) |
Prints a line in the log.
- Parameters
-
line is the line to be printed
Definition at line 861 of file logger.cpp.
◆ println() [2/4]
void bitpit::Logger::println | ( | const std::string & | line, |
const log::Level | severity, | ||
log::Visibility | visibility ) |
Prints a line in the log.
- Parameters
-
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 895 of file logger.cpp.
◆ println() [3/4]
void bitpit::Logger::println | ( | const std::string & | line, |
log::Level | severity ) |
Prints a line in the log.
- Parameters
-
line is the line to be printed severity is the severity of the line that will be printed
Definition at line 872 of file logger.cpp.
◆ println() [4/4]
void bitpit::Logger::println | ( | const std::string & | line, |
log::Visibility | visibility ) |
Prints a line in the log.
- Parameters
-
line is the line to be printed visibility is the visibility of the line that will be printed
Definition at line 883 of file logger.cpp.
◆ setConsoleTimestampEnabled()
void bitpit::Logger::setConsoleTimestampEnabled | ( | bool | enabled | ) |
Enables the timestamp on the console.
- Parameters
-
enabled if set to true enables the timestamp on the console.
Definition at line 669 of file logger.cpp.
◆ setConsoleVerbosity()
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.
- Parameters
-
threshold is the verbosity threshold
Definition at line 689 of file logger.cpp.
◆ setContext()
void bitpit::Logger::setContext | ( | const std::string & | context | ) |
Sets the context used when printing the messages.
- Parameters
-
context is the context used when printing the messages.
Definition at line 799 of file logger.cpp.
◆ setDefaultSeverity()
void bitpit::Logger::setDefaultSeverity | ( | log::Level | severity | ) |
Sets the default severity of the messages.
- Parameters
-
severity is the default severity of the messages
Definition at line 546 of file logger.cpp.
◆ setDefaultVisibility()
void bitpit::Logger::setDefaultVisibility | ( | log::Visibility | visibility | ) |
Sets the default visibility of the messages.
- Parameters
-
visibility is the default visibility of the messages
Definition at line 588 of file logger.cpp.
◆ setFileTimestampEnabled()
void bitpit::Logger::setFileTimestampEnabled | ( | bool | enabled | ) |
Enables the timestamp on the log file.
- Parameters
-
enabled if set to true enables the timestamp on the log file
Definition at line 756 of file logger.cpp.
◆ setFileVerbosity()
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.
- Parameters
-
threshold is the verbosity threshold
Definition at line 776 of file logger.cpp.
◆ setIndentation()
void bitpit::Logger::setIndentation | ( | int | delta | ) |
Sets the indentation level used when printing the messages.
- Parameters
-
delta is the relative indentation level
Definition at line 825 of file logger.cpp.
◆ setPriority()
void bitpit::Logger::setPriority | ( | log::Priority | priority | ) |
Sets the default priority of the messages.
- Parameters
-
priority is the default priority of the messages
Definition at line 568 of file logger.cpp.
◆ setTimestampEnabled()
void bitpit::Logger::setTimestampEnabled | ( | bool | enabled | ) |
Enables the timestamp both on the console and on the log file.
- Parameters
-
enabled if set to true enables the timestamp both on the console and on the log file.
Definition at line 647 of file logger.cpp.
◆ setVerbosities()
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.
- Parameters
-
threshold is the verbosity threshold
Definition at line 635 of file logger.cpp.
◆ setVisibility()
void bitpit::Logger::setVisibility | ( | log::Visibility | visibility | ) |
Sets the visibility of the messages.
- Parameters
-
visibility is the default visibility of the messages
Definition at line 610 of file logger.cpp.
Friends And Related Symbol Documentation
◆ LoggerManager
|
friend |
Definition at line 145 of file logger.hpp.
The documentation for this class was generated from the following files:
- src/common/logger.hpp
- src/common/logger.cpp
