Rudiments
|
Inherits object.
Public Member Functions | |
logger () | |
~logger () | |
void | addLogDestination (logdestination *logdest) |
void | removeLogDestination (logdestination *logdest) |
void | removeAllLogDestinations () |
void | setIndent (char ch) |
char | getIndent () |
void | setWideIndent (wchar_t ch) |
char | getWideIndent () |
void | setLogLevel (uint8_t level) |
uint8_t | getLogLevel () |
void | start (uint8_t level, const char *header, uint32_t indent, const char *string) |
void | start (uint8_t level, const wchar_t *header, uint32_t indent, const wchar_t *string) |
void | write (uint8_t level, const char *header, uint32_t indent, const char *format,...) |
void | write (uint8_t level, const wchar_t *header, uint32_t indent, const wchar_t *format,...) |
void | write (uint8_t level, const char *header, uint32_t indent, const char *format, va_list *argp) |
void | write (uint8_t level, const wchar_t *header, uint32_t indent, const wchar_t *format, va_list *argp) |
void | end (uint8_t level, const char *header, uint32_t indent) |
void | end (uint8_t level, const wchar_t *header, uint32_t indent) |
Public Member Functions inherited from object | |
virtual | ~object () |
Static Public Member Functions | |
static char * | getLogHeader (const char *name) |
static wchar_t * | getLogHeader (const wchar_t *name) |
The logger class and associated logdestination classes provide methods for logging data from an application. The following destinations are supported: file, syslog, stdout and stderr
To use these classes: instantiate one or more logdestinations, instantiate a logger, and add the logdestination instance(s) to the logger class instance using addLogDestination(). Then, each call to a logger class method will output logging information to each of the logdestinations in seqence.
logger::logger | ( | ) |
Creates an instance of the logger class.
logger::~logger | ( | ) |
Deletes this instance of the logger class.
void logger::addLogDestination | ( | logdestination * | logdest | ) |
Add "logdest" to the list of destinations that log entries will be written to.
void logger::end | ( | uint8_t | level, |
const char * | header, | ||
uint32_t | indent | ||
) |
If the current logging level is equal to or greater than "level", then writes "header", followed by "indent" indentations, followed by "}" as a single log entry.
void logger::end | ( | uint8_t | level, |
const wchar_t * | header, | ||
uint32_t | indent | ||
) |
If the current logging level is equal to or greater than "level", then writes "header", followed by "indent" indentations, followed by "}" as a single log entry.
char logger::getIndent | ( | ) |
Returns the character currently used when indenting.
|
static |
Returns a string containing the current date, followed by "name", followed by the process id in brackets. For example:
01/05/2002 12:54:23 myprogram [2421]
Note that this method allocates a string internally and returns it. This string must be deleted by the calling program.
Note that this method uses getSystemDateAndTime() from the datetime class. If you are using getLogHeader() in a multi-threaded application, you must supply a mutex to the datetime class using it's setMutex() method.
|
static |
Returns a string containing the current date, followed by "name", followed by the process id in brackets. For example:
01/05/2002 12:54:23 myprogram [2421]
Note that this method allocates a string internally and returns it. This string must be deleted by the calling program.
Note that this method uses getSystemDateAndTime() from the datetime class. If you are using getLogHeader() in a multi-threaded application, you must supply a mutex to the datetime class using it's setMutex() method.
uint8_t logger::getLogLevel | ( | ) |
Returns the logging level.
char logger::getWideIndent | ( | ) |
Returns the wide character currently used when indenting.
void logger::removeAllLogDestinations | ( | ) |
Remove all entries from the list of destinations that log entries will be written to.
void logger::removeLogDestination | ( | logdestination * | logdest | ) |
Remove "logdest" from the list of destinations that log entries will be written to.
void logger::setIndent | ( | char | ch | ) |
Sets the character to be used when indenting to "ch".
void logger::setLogLevel | ( | uint8_t | level | ) |
Sets the logging level to "level".
void logger::setWideIndent | ( | wchar_t | ch | ) |
Sets the wide character to be used when indenting to "ch".
void logger::start | ( | uint8_t | level, |
const char * | header, | ||
uint32_t | indent, | ||
const char * | string | ||
) |
If the current logging level is equal to or greater than "level", then writes "header", followed by "indent" indentations, followed by "string" followed by " {" as a single log entry.
void logger::start | ( | uint8_t | level, |
const wchar_t * | header, | ||
uint32_t | indent, | ||
const wchar_t * | string | ||
) |
If the current logging level is equal to or greater than "level", then writes "header", followed by "indent" indentations, followed by "string" followed by " {" as a single log entry.
void logger::write | ( | uint8_t | level, |
const char * | header, | ||
uint32_t | indent, | ||
const char * | format, | ||
va_list * | argp | ||
) |
If the current logging level is equal to or greater than "level", then writes "header", followed by "indent" indentations, followed by "va_list" formatted using "format" as a single log entry.
void logger::write | ( | uint8_t | level, |
const char * | header, | ||
uint32_t | indent, | ||
const char * | format, | ||
... | |||
) |
If the current logging level is equal to or greater than "level", then writes "header", followed by "indent" indentations, followed by "..." formatted using "format" as a single log entry.
void logger::write | ( | uint8_t | level, |
const wchar_t * | header, | ||
uint32_t | indent, | ||
const wchar_t * | format, | ||
va_list * | argp | ||
) |
If the current logging level is equal to or greater than "level", then writes "header", followed by "indent" indentations, followed by "va_list" formatted using "format" as a single log entry.
void logger::write | ( | uint8_t | level, |
const wchar_t * | header, | ||
uint32_t | indent, | ||
const wchar_t * | format, | ||
... | |||
) |
If the current logging level is equal to or greater than "level", then writes "header", followed by "indent" indentations, followed by "..." formatted using "format" as a single log entry.