libcommonc++  0.7
ConsoleLogger Class Reference

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

#include <ConsoleLogger.h++>

Inheritance diagram for ConsoleLogger:
Collaboration diagram for ConsoleLogger:

Public Member Functions

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

Static Public Attributes

static const size_t LOG_BUFFER_SIZE = 1024
 The log buffer size. More...
 

Protected Member Functions

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

Detailed Description

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

Author
Mark Lindner

Constructor & Destructor Documentation

◆ ConsoleLogger()

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

Construct a new ConsoleLogger with the given log message format.

Parameters
formatThe log message format.

◆ ~ConsoleLogger()

Destructor.

Member Function Documentation

◆ disableLogLevel()

void disableLogLevel ( LogLevel  level)
inherited

Disable a specific log level.

Parameters
levelThe level to disable.

◆ enableLogLevel()

void enableLogLevel ( LogLevel  level)
inherited

Enable a specific log level.

Parameters
levelThe level to enable.

◆ getLogFormat()

LogFormat& getLogFormat ( )
inlineinherited

Get the LogFormat used by this Logger.

◆ isLogLevelEnabled()

bool isLogLevelEnabled ( LogLevel  level) const
inherited

Test if a specific log level is enabled.

◆ log()

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

Log a message.

Parameters
levelThe log level (severity).
fileThe source filename.
lineThe source file line number.
messageThe log message.
...Optional message arguments.

◆ setFormat()

void setFormat ( const String format)
inherited

Set the log message format.

Parameters
formatThe log message format.

◆ vlog()

void vlog ( LogLevel  level,
const char *  file,
int  line,
const char *  message,
va_list  args 
)
inherited

Log a message.

Parameters
levelThe log level (severity).
fileThe source filename.
lineThe source file line number.
messageThe log message.
argsOptional message arguments.

◆ write()

bool write ( CharBuffer buffer)
protectedvirtual

Write a preformatted log message to the console.

Implements Logger.

Member Data Documentation

◆ LOG_BUFFER_SIZE

const size_t LOG_BUFFER_SIZE = 1024
staticinherited

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: