Logging class - handles screen output and file logging. More...
#include <Logger.h>
Classes | |
struct | Log |
Public Member Functions | |
void | log (int logLevel, std::string message) |
void | saveTo (std::string fileName) |
void | saveTo (bool check=false) |
void | saveToX (std::string fileName) |
void | saveToX () |
void | flushLog () |
deletes current logs | |
void | setLogFrequency (uint freq) |
void | registerParameters (StateP state) |
bool | initialize (StateP state) |
bool | operate (StateP) |
void | closeLog () |
int | getLogLevel () |
Protected Attributes | |
std::vector< Log > | logs_ |
int | currentLevel_ |
uint | logFrequency_ |
std::string | logFileName_ |
bool | bFileDefined_ |
std::ofstream | logFile_ |
StateP | state_ |
Logging class - handles screen output and file logging.
Current log levels (1-5): 1=only basic, essential information, 3=medium logging level (default), 5=logs everything
Definition at line 32 of file Logger.h.
bool Logger::initialize | ( | StateP | state | ) |
Initialize Logger, read current logLevel from the Registry (configuration file)
Definition at line 33 of file Logger.cpp.
void Logger::log | ( | int | logLevel, | |
std::string | message | |||
) |
Puts a string message into existing log and marks it with appropriate logLevel.
Definition at line 63 of file Logger.cpp.
void Logger::saveTo | ( | bool | check = false |
) |
Saves current session log into a configured logfile. New log is appended to the end of the file.
Definition at line 96 of file Logger.cpp.
void Logger::saveTo | ( | std::string | fileName | ) |
Saves current session log into a file named fileName. If file with the same name already exists, log is appended to the end of the file.
Definition at line 84 of file Logger.cpp.
void Logger::setLogFrequency | ( | uint | freq | ) |
Sets the log output frequency (in generations). If not set, the default is 1 (output each generation).
Definition at line 178 of file Logger.cpp.