#include <nap/logger.h>
Public Member Functions | |
| void | setCurrentLevel (const LogLevel &level) |
| void | addHandler (std::unique_ptr< LogHandler > handler) |
Static Public Member Functions | |
| static void | setLevel (const LogLevel &lvl) |
| static Logger & | instance () |
| static const std::vector< const LogLevel * > & | getLevels () |
| static const LogLevel * | getLevel (const std::string &name) |
| static void | addFileHandler (const std::string &filename) |
| static void | logToDirectory (const std::string &directory, const std::string &prefix="log") |
Public Attributes | |
| Signal< LogMessage > | log |
The logger is a singleton that can be called to log messages of various degrees of severity. By default logged messages are printed to the console. Invoke logToDirectory() to log messages to file.
|
static |
Convenience function to start logging to a file.
| filename | The filename to write log entries to. |
| void addHandler | ( | std::unique_ptr< LogHandler > | handler | ) |
Add a handler to this logger. The logger will take ownership of it. The handle will provide a log level that may filter out unwanted messages during logging.
| handler | The handler to be invoked by this logger. |
|
static |
| name | the name of the log level |
|
static |
|
static |
|
static |
Start logging to a file in the specified directory. Writes all log information into a file with the current date/time in the name. Final log filename: {directory}/{prefix}_{timestamp}.log
| directory | the directory to log to. |
| prefix | name of the log_file. |
| void setCurrentLevel | ( | const LogLevel & | level | ) |
Sets the current log level for all handlers.
| level | new log level, messages lower than the selected log level won't be displayed. |
|
static |
Sets the current log level for all handlers.
| lvl | new log level, messages lower than the selected log level won't be displayed. |
| Signal<LogMessage> log |