45void init(std::filesystem::path log_dir_path =
"");
51void debug(
const std::string& message,
int target_printer = 0);
57void info(
const std::string& message,
int target_printer = 0);
63void warning(
const std::string& message,
int target_printer = 0);
69void error(
const std::string& message,
int target_printer = 0);
76void log(
LogLevel level,
const std::string& message,
int target_printer = 0);
Contains functions for logging.
Definition log.cpp:58
LogLevel
Represents the importance of a log message.
Definition log.h:19
int num_log_files
Numberof log files to keep. One file is written per init() call.
Definition log.h:38
LogLevel log_level
Current log level. Messages with a log level less important than this will be ignored.
Definition log.h:30
void info(const std::string &message, int target_printer)
Prints the current time and date followed by an info message.
Definition log.cpp:69
std::vector< std::function< void(std::string, LogLevel)> > log_printers
Callback function used to output log messages.
Definition log.h:32
void log(LogLevel level, const std::string &message, int target_printer)
Calls the appropriate logging function for the given log level with the given message.
Definition log.cpp:79
std::filesystem::path log_file_path
Path to a log file. If this is != "" and exists, the log will be appended to that file.
Definition log.h:36
std::filesystem::path log_dir
Directory to which log files should be written. Empty string means no log files.
Definition log.h:34
void error(const std::string &message, int target_printer)
Prints the current time and date followed by an error message.
Definition log.cpp:59
void debug(const std::string &message, int target_printer)
Prints the current time and date followed by a debug message.
Definition log.cpp:74
void warning(const std::string &message, int target_printer)
Prints the current time and date followed by a warning message.
Definition log.cpp:64