ConsoleLogger Class Reference

A logger that writes to the console (the standard error stream). More...

#include <ConsoleLogger.h++>

Inheritance diagram for ConsoleLogger:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 ConsoleLogger (const String &format="[%d %t] %@%m%.")
 Construct a new ConsoleLogger with the given log message format.
 ~ConsoleLogger ()
 Destructor.
void setFormat (const String &format)
 Set the log message format.
void log (LogLevel level, const char *file, int line, const char *message,...)
 Log a message.
void vlog (LogLevel level, const char *file, int line, const char *message, va_list args)
 Log a message.
void enableLogLevel (LogLevel level)
 Enable a specific log level.
void disableLogLevel (LogLevel level)
 Disable a specific log level.
bool isLogLevelEnabled (LogLevel level) const
 Test if a specific log level is enabled.
LogFormatgetLogFormat ()
 Get the LogFormat used by this Logger.

Static Public Attributes

static const size_t LOG_BUFFER_SIZE = 1024
 The log buffer size.

Protected Member Functions

virtual bool write (CharBuffer &buffer)
 Write a preformatted log message to the console.

Detailed Description

A logger that writes to the console (the standard error stream).

Author:
Mark Lindner

Constructor & Destructor Documentation

ConsoleLogger ( const String format = "[%d %t] %@%m%."  ) 

Construct a new ConsoleLogger with the given log message format.

Parameters:
format The log message format.
~ConsoleLogger (  ) 

Destructor.


Member Function Documentation

void disableLogLevel ( LogLevel  level  )  [inherited]

Disable a specific log level.

Parameters:
level The level to disable.
void enableLogLevel ( LogLevel  level  )  [inherited]

Enable a specific log level.

Parameters:
level The level to enable.
LogFormat& getLogFormat (  )  [inline, inherited]

Get the LogFormat used by this Logger.

bool isLogLevelEnabled ( LogLevel  level  )  const [inherited]

Test if a specific log level is enabled.

void log ( LogLevel  level,
const char *  file,
int  line,
const char *  message,
  ... 
) [inherited]

Log a message.

Parameters:
level The log level (severity).
file The source filename.
line The source file line number.
message The log message.
... Optional message arguments.
void setFormat ( const String format  )  [inherited]

Set the log message format.

Parameters:
format The log message format.
void vlog ( LogLevel  level,
const char *  file,
int  line,
const char *  message,
va_list  args 
) [inherited]

Log a message.

Parameters:
level The log level (severity).
file The source filename.
line The source file line number.
message The log message.
args Optional message arguments.
bool write ( CharBuffer buffer  )  [protected, virtual]

Write a preformatted log message to the console.

Implements Logger.


Member Data Documentation

const size_t LOG_BUFFER_SIZE = 1024 [static, inherited]

The log buffer size.

Indicates the maximum length of a log message, in characters. Messages which exceed this length will be truncated.


The documentation for this class was generated from the following files:
Generated on Sat Nov 26 16:49:08 2011 for libcommonc++ by  doxygen 1.6.3