Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

Logger Class Reference

#include <Logger.h>

List of all members.


Detailed Description

The Logger class provides debugging functionality for output messages into a separate file, the log file.

Author:
Thomas Jacob

Definition at line 145 of file Logger.h.

Public Member Functions

short Printf (const char *source, long lineNumber, int type, const char *format,...)
 Writes a log message into the log file.

 ~Logger ()
 Destroys the logger.


Static Public Member Functions

LoggerGet ()
 Returns the logger singleton.


Private Member Functions

void Close ()
 Closes the log file, if it is open.

 Logger ()
 Creates a new logger.

bool Open ()
 Opens the log file, if it is not already open.

void WriteTimeStampPrefix ()
 Writes the date/time prefix.

void WriteTimeStampPrefix (int type)
 Writes the date/time and type prefix.


Private Attributes

FILE * File
 The log file.

char * FileName
 The log file name.

int LogLevel
 The current log level (logging threshold).

bool OptionSet
 Whether a command line option for the log level is set.

unsigned long StartTickCount
 The tick count on logger startup.


Static Private Attributes

Logger Singleton
 The logger singleton.


Constructor & Destructor Documentation

Logger  )  [private]
 

Creates a new logger.

~Logger  ) 
 

Destroys the logger.


Member Function Documentation

void Close  )  [private]
 

Closes the log file, if it is open.

Logger* Get  )  [inline, static]
 

Returns the logger singleton.

bool Open  )  [private]
 

Opens the log file, if it is not already open.

short Printf const char *  source,
long  lineNumber,
int  type,
const char *  format,
... 
 

Writes a log message into the log file.

Source name and line number are also added automatically. Another feature of this method is the ellipse to provide flexibility like the printf functions of C. Do not call this method directly, but use the LOGPRINTFx macros, that automatically add source name and line number.

Parameters:
source The source file name of the caller.
lineNumber The source line number of the caller.
type The log message type.
format The output format according to the printf function.
... The ellipse according to the printf function.
Returns:
Always zero. It is only required by the macros.

void WriteTimeStampPrefix  )  [private]
 

Writes the date/time prefix.

void WriteTimeStampPrefix int  type  )  [private]
 

Writes the date/time and type prefix.

Parameters:
type The log type.


Member Data Documentation

FILE* File [private]
 

The log file.

Definition at line 152 of file Logger.h.

char* FileName [private]
 

The log file name.

Definition at line 157 of file Logger.h.

int LogLevel [private]
 

The current log level (logging threshold).

Definition at line 169 of file Logger.h.

bool OptionSet [private]
 

Whether a command line option for the log level is set.

Definition at line 174 of file Logger.h.

Logger Singleton [static, private]
 

The logger singleton.

Definition at line 179 of file Logger.h.

unsigned long StartTickCount [private]
 

The tick count on logger startup.

Definition at line 199 of file Logger.h.


The documentation for this class was generated from the following file:
Generated on Tue Oct 3 00:23:40 2006 for ToolBox by doxygen 1.3.6