Logger Class Reference

An abstract base class for threadsafe loggers. More...

#include <Logger.h++>

Inheritance diagram for Logger:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 Logger (const String &format)
 Construct a new Logger with the given log message format.
virtual ~Logger ()
 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)=0
 Write a formatted log message to the logging endpoint.

Detailed Description

An abstract base class for threadsafe loggers.

Author:
Mark Lindner

Constructor & Destructor Documentation

Logger ( const String format  ) 

Construct a new Logger with the given log message format.

Parameters:
format The log message format.
~Logger (  )  [virtual]

Destructor.


Member Function Documentation

void disableLogLevel ( LogLevel  level  ) 

Disable a specific log level.

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

Enable a specific log level.

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

Get the LogFormat used by this Logger.

bool isLogLevelEnabled ( LogLevel  level  )  const

Test if a specific log level is enabled.

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

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  ) 

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 
)

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.
virtual bool write ( CharBuffer buffer  )  [protected, pure virtual]

Write a formatted log message to the logging endpoint.

Parameters:
buffer The buffer containing the log message.
Returns:
true if the message was written successfully, false otherwise.

Implemented in ConsoleLogger, and FileLogger.


Member Data Documentation

const size_t LOG_BUFFER_SIZE = 1024 [static]

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:09 2011 for libcommonc++ by  doxygen 1.6.3