Logger Class Reference

The static Logger class lets the user manage the verbosity of internal log messages, as well as where they are directed. More...

#include <Logger.h>

List of all members.

Static Public Member Functions

static int getLogLevel ()
 Accessor method.
static void setLogLevel (int dl)
 Accessor method for setting the logging level.
static void setLogFile (ofstream *ost)
 Sets the output stream to which to direct the logging.
static void log (string s)
 Logs the passed message to the stream, and to standard output.
static void indent ()
 Handle indenting to the current callDepth: Logs two spaces, callDepth times.
static void incCallDepth ()
 Increments the call depth.
static void decCallDepth ()
 Decrements the call depth.

Static Public Attributes

static int logLevel = 0
 The desired verbosity level - if 0, no logging is done.
static ofstream * logFile = 0
 The output file stream to which the logging is sent.
static int callDepth = 0
 How deep in the call tree we are - determines indenting.


Detailed Description

The static Logger class lets the user manage the verbosity of internal log messages, as well as where they are directed.

All messages are sent to standard output, in addition to any specified log file. The class tracks two scalars: the logLevel is the desired level of verbosity (each log message has an associated logLevel that the class' logLevel is compared to). In addition, callDepth can be increased or decreased by the user, and it controls the indenting of messages. By controlling callDepth, the user can control the formatting of logging. The header defines a series of macros that simplify the task of working with the Logger class. The default is to do no logging. If you don't want to incur the small overhead of logging, it can be turned off with the NLOG compilation flag, assuming that logging is done via the provided macros.


Member Function Documentation

static void Logger::decCallDepth  )  [inline, static]
 

Decrements the call depth.

static int Logger::getLogLevel  )  [inline, static]
 

Accessor method.

Returns:
The current system logging level.

static void Logger::incCallDepth  )  [inline, static]
 

Increments the call depth.

static void Logger::indent  )  [inline, static]
 

Handle indenting to the current callDepth: Logs two spaces, callDepth times.

static void Logger::log string  s  )  [inline, static]
 

Logs the passed message to the stream, and to standard output.

Note that comparing the message's log level to the system logLevel is up to the user, but that the Logger.h header provides utility macros to handle that.

Parameters:
s The message to be logged.

static void Logger::setLogFile ofstream *  ost  )  [inline, static]
 

Sets the output stream to which to direct the logging.

Parameters:
ost The target output stream.

static void Logger::setLogLevel int  dl  )  [inline, static]
 

Accessor method for setting the logging level.

Parameters:
dl The new system log level.


Member Data Documentation

int Logger::callDepth = 0 [static]
 

How deep in the call tree we are - determines indenting.

ofstream * Logger::logFile = 0 [static]
 

The output file stream to which the logging is sent.

int Logger::logLevel = 0 [static]
 

The desired verbosity level - if 0, no logging is done.


The documentation for this class was generated from the following files:
Generated on Tue Dec 13 11:00:27 2005 for Classer by  doxygen 1.4.3