Public Types | Public Member Functions

Logger Class Reference

Protocol class which defines the interface for all types of logger. More...

#include <keyvalue/sys/logger/Logger.h>

Inheritance diagram for Logger:
Inheritance graph
[legend]

List of all members.

Public Types

enum  Device { Console, File, Standard }

Public Member Functions

virtual unsigned int getLevel () const =0
 Gets Logger's current level.
virtual void setLevel (unsigned int level)=0
 Sets Logger's current level.
virtual bool log (const Message &message)=0
 Logs a Message.

Detailed Description

Protocol class which defines the interface for all types of logger.

Each Logger and each Message (except those of type Error) has a verbosity level. If a Logger of level m receives a Message of level n with m > n, then the Message is processed by the Logger. Otherwise it is ignored. Therefore, a 0-level Logger ignores every Message.

On the other hand, a Message of type Error is never ignored.


Member Function Documentation

virtual unsigned int getLevel (  )  const [pure virtual]

Gets Logger's current level.

Returns:
The level.

Implemented in LoggerImpl< PrefixPolicy, ColorPolicy, SafetyPolicy >.

virtual void setLevel ( unsigned int  level  )  [pure virtual]

Sets Logger's current level.

Parameters:
level : New level.

Implemented in LoggerImpl< PrefixPolicy, ColorPolicy, SafetyPolicy >.

virtual bool log ( const Message message  )  [pure virtual]

Logs a Message.

This method may fail if the implemented Logger cannot process the message (e.g. a console Logger that has no longer a console window).

Parameters:
message : Message to be logged.
Returns:
This method returns true if it is successful.

Implemented in LoggerImpl< PrefixPolicy, ColorPolicy, SafetyPolicy >.