Contains functions for logging.
More...
|
enum | LogLevel { LOG_ERROR = 0
, LOG_WARNING = 1
, LOG_INFO = 2
, LOG_DEBUG = 3
} |
| Represents the importance of a log message.
|
|
|
void | error (const std::string &message, int target_printer=0) |
| Prints the current time and date followed by an error message.
|
|
void | warning (const std::string &message, int target_printer=0) |
| Prints the current time and date followed by a warning message.
|
|
void | info (const std::string &message, int target_printer=0) |
| Prints the current time and date followed by an info message.
|
|
void | debug (const std::string &message, int target_printer=0) |
| Prints the current time and date followed by a debug message.
|
|
void | log (LogLevel level, const std::string &message, int target_printer=0) |
| Calls the appropriate logging function for the given log level with the given message.
|
|
void | init (sfs::path log_dir_path) |
|
void | init (std::filesystem::path log_dir_path="") |
| init Initializes the logger by setting the current log_file_path and renaming or deleting old log files if needed.
|
|
|
LogLevel | log_level = LOG_INFO |
| Current log level. Messages with a log level less important than this will be ignored.
|
|
std::vector< std::function< void(std::string, LogLevel)> > | log_printers |
| Callback function used to output log messages.
|
|
std::filesystem::path | log_dir = "" |
| Directory to which log files should be written. Empty string means no log files.
|
|
std::filesystem::path | log_file_path = "" |
| Path to a log file. If this is != "" and exists, the log will be appended to that file.
|
|
int | num_log_files = 10 |
| Numberof log files to keep. One file is written per init() call.
|
|
Contains functions for logging.
◆ debug()
void Log::debug |
( |
const std::string & | message, |
|
|
int | target_printer = 0 ) |
Prints the current time and date followed by a debug message.
- Parameters
-
message | Message to be printed. |
target_printer | Log printer to use for output. |
◆ error()
void Log::error |
( |
const std::string & | message, |
|
|
int | target_printer = 0 ) |
Prints the current time and date followed by an error message.
- Parameters
-
message | Message to be printed. |
target_printer | Log printer to use for output. |
◆ info()
void Log::info |
( |
const std::string & | message, |
|
|
int | target_printer = 0 ) |
Prints the current time and date followed by an info message.
- Parameters
-
message | Message to be printed. |
target_printer | Log printer to use for output. |
◆ init()
void Log::init |
( |
std::filesystem::path | log_dir_path = "" | ) |
|
init Initializes the logger by setting the current log_file_path and renaming or deleting old log files if needed.
- Parameters
-
log_dir_path | Path to the logging directory. |
◆ log()
void Log::log |
( |
LogLevel | level, |
|
|
const std::string & | message, |
|
|
int | target_printer = 0 ) |
Calls the appropriate logging function for the given log level with the given message.
- Parameters
-
level | Log level for the message. |
message | Message to be printed. |
target_printer | Log printer to use for output. |
◆ warning()
void Log::warning |
( |
const std::string & | message, |
|
|
int | target_printer = 0 ) |
Prints the current time and date followed by a warning message.
- Parameters
-
message | Message to be printed. |
target_printer | Log printer to use for output. |