Classes | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

XtermConsole Class Reference

Implements an xterm console Logger. More...

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

Inheritance diagram for XtermConsole:
Inheritance graph
[legend]

List of all members.

Classes

class  FileRaii
 XtermConsole's helper class for file management. More...

Public Types

typedef LoggerImpl< AddPrefix,
XtermColor,
ForwardToGlobalLogger
LoggerImpl_
enum  Device { Console, File, Standard }

Public Member Functions

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

Protected Member Functions

bool sendHeader ()
 Sends the header message.
virtual bool send (const string &message)=0
virtual bool send (const string &message)=0

Private Member Functions

bool send (const string &message)
 Sends a raw string message to the Logger's underlying device.

Private Attributes

unsigned int level_
pid_t childPid_
FileRaii writeSlave_

Detailed Description

Implements an xterm console Logger.


Member Function Documentation

bool send ( const string &  message  )  [private, virtual]

Sends a raw string message to the Logger's underlying device.

Parameters:
message : Message to be sent.
Returns:
This method returns false if it fails. Otherwise, it returns true.

Implements LoggerImpl< AddPrefix, XtermColor >.

virtual unsigned int getLevel (  )  const [pure virtual, inherited]

Gets Logger's current level.

Returns:
The level.

Implemented in LoggerImpl< PrefixPolicy, ColorPolicy, SafetyPolicy >.

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

Sets Logger's current level.

Parameters:
level : New level.

Implemented in LoggerImpl< PrefixPolicy, ColorPolicy, SafetyPolicy >.

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

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 >.

bool sendHeader (  )  [protected, inherited]

Sends the header message.

This method sends (throw send()) an opening header message to the underlying device of the Logger.

Returns:
This method returns what print() does.