LogFile Class Reference

Log file class. More...

#include <LogFile.h>

List of all members.

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.

Detailed Description

Log file class.

Log file class provides facilities to store messages to a text file with simple formatting.


Member Enumeration Documentation

Log levels

Enumerator:
LOG_DEBUG 

Log everything

LOG_INFO 

Log informational messages

LOG_WARNING 

Log warnings

LOG_ERROR 

Log errors only

LOG_CRITICAL 

Log critical errors


Constructor & Destructor Documentation

LogFile::LogFile ( const char *  fileName  ) 

Log file constructor.

Initializes the log file object.

Parameters:
fileName Specifies the log file name
LogFile::~LogFile (  )  [virtual]

Log file destructor.

Destroys the log file object.


Member Function Documentation

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.

Parameters:
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.
Returns:
Returns true if writing the log entry was successful, false otherwise.
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.

Parameters:
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.
Returns:
Returns true if writing the log entry was successful, false otherwise

The documentation for this class was generated from the following files:
Generated on Wed Oct 20 11:13:44 2010 for libspatha by  doxygen 1.6.3