|
logger
|
Logger namespace. Contains all available functions and classes. More...
Classes | |
| class | Line |
| Allows piping content in order to build a log message. Once the object is destroyed, the piped content will be logged to the appropriate outputs. More... | |
Enumerations | |
| enum | Level { Verbose, Debug, Info, Warning, Error, Off } |
| Levels for filtering messages based on importance. More... | |
Functions | |
| bool | enabled () |
| Checks if the logger is enabled. More... | |
| Level | consoleLevel () |
| Gets the minimum Level for console output. More... | |
| Level | fileLevel () |
| Gets the minimum Level for file output. More... | |
| std::string | logFile () |
| Gets the output file for file logging. More... | |
| void | enable (const Level &consoleLevel=Info, const Level &fileLevel=Off, const std::string &logFileFormat="log/%Y-%m-%d-%H-%M-%S.txt") |
| Enables the logger with the given minimum Levels. Call again to change these settings. This results in a new log file being generated, if file logging is enabled. More... | |
| void | disable () |
| Disables the logger. | |
| int | contextLength () |
| Gets the context lenght. More... | |
| void | setContextLength (const int &contextLength) |
| Sets the context lenght. More... | |
| bool | printTime () |
| Checks whether the current time is included in output. More... | |
| void | setPrintTime (const bool &printTime) |
| Sets whether the current time should be included in output. More... | |
| std::string | timeFormat () |
| Gets the format used printing the time. More... | |
| void | setTimeFormat (const std::string &timeFormat) |
| Sets the format used printing the time. More... | |
| Line | verbose (const std::string &context="") |
| Creates a new Line object with the Level Verbose. Once this object is destroyed, the content will be sent to the outputs. When logging to console, messages with this level will be sent to cout. More... | |
| Line | debug (const std::string &context="") |
| Creates a new Line object with the Level Debug. Once this object is destroyed, the content will be sent to the outputs. When logging to console, messages with this level will be sent to cout. More... | |
| Line | info (const std::string &context="") |
| Creates a new Line object with the Level Info. Once this object is destroyed, the content will be sent to the outputs. When logging to console, messages with this level will be sent to cout. More... | |
| Line | warning (const std::string &context="") |
| Creates a new Line object with the Level Info. Once this object is destroyed, the content will be sent to the outputs. When logging to console, messages with this level will be sent to cerr. More... | |
| Line | error (const std::string &context="") |
| Creates a new Line object with the Level Error. Once this object is destroyed, the content will be sent to the outputs. When logging to console, messages with this level will be sent to cerr. More... | |
Logger namespace. Contains all available functions and classes.
| enum logger::Level |
Levels for filtering messages based on importance.
| Level logger::consoleLevel | ( | ) |
| int logger::contextLength | ( | ) |
Gets the context lenght.
| Line logger::debug | ( | const std::string & | context = "" | ) |
Creates a new Line object with the Level Debug. Once this object is destroyed, the content will be sent to the outputs. When logging to console, messages with this level will be sent to cout.
| context | The context in which the message is logged, allowing for more informative output. This could be the current function, for example. |
| void logger::enable | ( | const Level & | consoleLevel = Info, |
| const Level & | fileLevel = Off, |
||
| const std::string & | logFileFormat = "log/%Y-%m-%d-%H-%M-%S.txt" |
||
| ) |
Enables the logger with the given minimum Levels. Call again to change these settings. This results in a new log file being generated, if file logging is enabled.
| consoleLevel | Minimum Level for logging to console. Log messages with a lower Level won't be written to the console. |
| fileLevel | Minimum Level for logging to file. Log messages with a lower Level won't be written to the log file. |
| logFileFormat | Naming scheme for log files, see https://en.cppreference.com/w/cpp/io/manip/put_time for syntax. |
| bool logger::enabled | ( | ) |
Checks if the logger is enabled.
| Line logger::error | ( | const std::string & | context = "" | ) |
Creates a new Line object with the Level Error. Once this object is destroyed, the content will be sent to the outputs. When logging to console, messages with this level will be sent to cerr.
| context | The context in which the message is logged, allowing for more informative output. This could be the current function, for example. |
| Level logger::fileLevel | ( | ) |
| Line logger::info | ( | const std::string & | context = "" | ) |
Creates a new Line object with the Level Info. Once this object is destroyed, the content will be sent to the outputs. When logging to console, messages with this level will be sent to cout.
| context | The context in which the message is logged, allowing for more informative output. This could be the current function, for example. |
| std::string logger::logFile | ( | ) |
Gets the output file for file logging.
| bool logger::printTime | ( | ) |
Checks whether the current time is included in output.
| void logger::setContextLength | ( | const int & | contextLength | ) |
Sets the context lenght.
| contextLength | The context length. Contexts given to the message functions are adjusted to this number of characters. |
| void logger::setPrintTime | ( | const bool & | printTime | ) |
Sets whether the current time should be included in output.
| printTime | True to print the time, false otherwise. |
| void logger::setTimeFormat | ( | const std::string & | timeFormat | ) |
Sets the format used printing the time.
| std::string logger::timeFormat | ( | ) |
Gets the format used printing the time.
| Line logger::verbose | ( | const std::string & | context = "" | ) |
Creates a new Line object with the Level Verbose. Once this object is destroyed, the content will be sent to the outputs. When logging to console, messages with this level will be sent to cout.
| context | The context in which the message is logged, allowing for more informative output. This could be the current function, for example. |
| Line logger::warning | ( | const std::string & | context = "" | ) |
Creates a new Line object with the Level Info. Once this object is destroyed, the content will be sent to the outputs. When logging to console, messages with this level will be sent to cerr.
| context | The context in which the message is logged, allowing for more informative output. This could be the current function, for example. |
1.8.14