Abstract class
which implements main methods of concrete Loggers.
More...
#include <keyvalue/sys/logger/LoggerImpl.h>
Public Types | |
typedef LoggerImpl < PrefixPolicy, ColourPolicy, SafetyPolicy > | LoggerImpl_ |
enum | Device { Console, File, Standard } |
Logger devices. More... | |
Public Member Functions | |
unsigned int | getLevel () const |
Gets Logger's current level. | |
void | setLevel (unsigned int level) |
Sets Logger's current level. | |
bool | log (const Message &message) |
Logs a Message. | |
Protected Member Functions | |
LoggerImpl (unsigned int level) | |
bool | sendHeader () |
Sends the header message. | |
Private Member Functions | |
bool | process (const Message &message) |
Processes a Message and send its text content to the Logger's underlying device. | |
virtual bool | send (const string &message)=0 |
Sends a raw string message to the Logger's underlying device. | |
Private Attributes | |
unsigned int | level_ |
Abstract class
which implements main methods of concrete Loggers.
This is a template class
whose template
parameters are policy class
es that define how the Message has to be processed.
PrefixPolicy | : Defines how to process Message prefixes; | |
ColourPolicy | : Defines how to process Message colours; | |
SafetyPolicy | : Defines what to do when the Logger fails. |
unsigned int getLevel | ( | ) | const [virtual] |
void setLevel | ( | unsigned int | level | ) | [virtual] |
bool log | ( | const Message & | message | ) | [virtual] |
bool sendHeader | ( | ) | [protected] |
bool process | ( | const Message & | message | ) | [private] |
Processes a Message and send its text content to the Logger's underlying device.
This pure virtual method has to be implemented by each LoggerImpl. After processing the received Message this method should call send() to send the text content of the Message to the device of the Logger.
This method may fail if either any policy or the send() does so.
message | : Message to be processed. |
false
if it fails. Otherwise, it returns true
. virtual bool send | ( | const string & | message | ) | [private, pure virtual] |
Sends a raw string
message to the Logger's underlying device.
message | : Message to be sent. |
false
if it fails. Otherwise, it returns true
. Implemented in FileLogger, WindowsConsole, and XtermConsole.