libcommonc++
0.7
|
An abstract base class for threadsafe loggers. More...
#include <Logger.h++>
Public Member Functions | |
Logger (const String &format) | |
Construct a new Logger with the given log message format. More... | |
virtual | ~Logger () |
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... | |
LogFormat & | getLogFormat () |
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)=0 |
Write a formatted log message to the logging endpoint. More... | |
An abstract base class for threadsafe loggers.
Construct a new Logger with the given log message format.
format | The log message format. |
|
virtual |
Destructor.
void disableLogLevel | ( | LogLevel | level | ) |
Disable a specific log level.
level | The level to disable. |
void enableLogLevel | ( | LogLevel | level | ) |
Enable a specific log level.
level | The level to enable. |
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.
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.
format | The log message format. |
void vlog | ( | LogLevel | level, |
const char * | file, | ||
int | line, | ||
const char * | message, | ||
va_list | args | ||
) |
Log a message.
level | The log level (severity). |
file | The source filename. |
line | The source file line number. |
message | The log message. |
args | Optional message arguments. |
|
protectedpure virtual |
Write a formatted log message to the logging endpoint.
buffer | The buffer containing the log message. |
Implemented in FileLogger, and ConsoleLogger.
|
static |
The log buffer size.
Indicates the maximum length of a log message, in characters. Messages which exceed this length will be truncated.