The global logger class
.
More...
#include "keyvalue/sys/logger/GlobalLogger.h"
Public Types | |
enum | Device { Console, File, Standard } |
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. | |
Static Public Member Functions | |
static GlobalLogger & | getInstance () |
Gets the unique instance of this class . | |
static shared_ptr< Logger > | get () |
Gets registered Logger. | |
static void | set (shared_ptr< Logger > logger) |
Registers a new Logger. | |
static void | reset () |
Resets the GlobalLogger to its initial state (StdLogger). | |
Private Attributes | |
StdLogger | defaultLogger_ |
shared_ptr< Logger > | theLogger_ |
The global logger class
.
This class
is not a particular Logger implementation. Actually, it is a wrapper to the currently registered Logger.
This class
is a singleton that is constructed only when the GlobalLogger issolicited for the first time. On construction, a StdLogger is registered as the GlobalLogger. Later on, other Logger
can be registered.
unsigned int getLevel | ( | ) | const [virtual] |
void setLevel | ( | unsigned int | level | ) | [virtual] |
bool log | ( | const Message & | message | ) | [virtual] |
static GlobalLogger& getInstance | ( | ) | [static] |
Gets the unique instance of this class
.
return A reference to the unique instance.
static shared_ptr<Logger> get | ( | ) | [static] |
static void set | ( | shared_ptr< Logger > | logger | ) | [static] |
static void reset | ( | ) | [static] |
Resets the GlobalLogger to its initial state (StdLogger).
WARNING: If this method is called by one of the current registered Logger's method, the calling Logger may cease to exist immediately (it suicides). If this happens the calling Logger can no longer access any of its non static members.