146 void log(
LogLevel level,
const std::string &message);
195 const std::string &message);
215 for (T i = 1; i <= n; ++i) {
std::string getCurrentTimestamp()
Gets the current timestamp as a string.
void setLogLevel(LogLevel level)
Sets the minimum log level.
std::string formatLogMessage(const std::string &prefix, const std::string &message)
Formats a log message with a specified prefix.
void setLogFile(const std::string &logFile)
Sets the log file name for FILE_ONLY or CONSOLE_AND_FILE destinations.
void log(LogLevel level, const std::string &message)
Logs a message with the specified log level.
LogLevel logLevel
The minimum log level to record.
LogDestination logDestination
The log destination, which can be CONSOLE, FILE_ONLY, or CONSOLE_AND_FILE.
void setLogDestination(LogDestination destination)
Sets the log destination.
std::ofstream logFileStream
The output stream for logging to a file.
~Logger()
Logger destructor, destroys the Logger instance.
bool logToFile
Flag indicating whether to log messages to a file.
void enableTimestamps(bool enable)
Enables or disables timestamps in log messages.
std::string getLogPrefix(LogLevel level)
Gets the log prefix based on the log level.
Logger(LogLevel level=INFO, bool useTimestamp=true)
Constructs a Logger instance.
bool enableTimestamp
Flag indicating whether to include timestamps in log messages.
A class containing miscellaneous utility functions.
static T factorial(T n)
Calculates the factorial of the given integer or double.
The source C++ openGPMP namespace.