Log file class. More...
#include <LogFile.h>
Public Types | |
enum | LogLevel { LOG_DEBUG = 0, LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_CRITICAL } |
Public Member Functions | |
LogFile (const char *fileName) | |
Log file constructor. | |
virtual | ~LogFile () |
Log file destructor. | |
bool | logPrintf (LogLevel logLevel, const char *entryId, const char *entryFmt,...) |
Write message to log. | |
bool | logvPrintf (LogLevel logLevel, const char *entryId, const char *entryFmt, va_list arg) |
Write message to log. |
Log file class.
Log file class provides facilities to store messages to a text file with simple formatting.
enum LogFile::LogLevel |
LogFile::LogFile | ( | const char * | fileName | ) |
Log file constructor.
Initializes the log file object.
fileName | Specifies the log file name |
LogFile::~LogFile | ( | ) | [virtual] |
Log file destructor.
Destroys the log file object.
bool LogFile::logPrintf | ( | LogLevel | logLevel, | |
const char * | entryId, | |||
const char * | entryFmt, | |||
... | ||||
) |
Write message to log.
Writes a text message to the log file. The resulting message will be saved as a separate line in the text file, as specified below.
{TIMESTAMP}|{LEVEL}|{ID}|{TEXT}
Line breaks are Windows style, in order for log files to be easily readable on all systems.
logLevel | Specifies message type. | |
entryId | Contains the identifier of the module that generated the given message, or any other identifier that helps classifying messages. | |
entryFmt | Contains message text. May contain printf-style formatting fields. | |
... | Lists arguments for text format fields, printf-style. |
bool LogFile::logvPrintf | ( | LogLevel | logLevel, | |
const char * | entryId, | |||
const char * | entryFmt, | |||
va_list | arg | |||
) |
Write message to log.
Writes a text message to the log file. The resulting message will be saved as a separate line in the text file, as specified below.
{TIMESTAMP}|{LEVEL}|{ID}|{TEXT}
Linebreaks are Windows style, in order for log files to be easily readable on all systems.
logLevel | Specifies message type. | |
entryId | Contains the identifier of the module that generated the given message, or any other identifier that helps classifying messages. | |
entryFmt | Contains message text. May contain vsprintf-style formatting fields. | |
arg | Lists arguments for text format fields, vsprintf-style. |