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

WindowsConsole Class Reference

This class implements a Windows console Logger. More...

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

Inheritance diagram for WindowsConsole:
Inheritance graph
[legend]

List of all members.

Public Types

typedef LoggerImpl
< keyvalue::logger::AddPrefix,
keyvalue::logger::XtermColour,
keyvalue::logger::ForwardToGlobalLogger
MyBase_
typedef LoggerImpl< AddPrefix,
XtermColour,
ForwardToGlobalLogger
LoggerImpl_
enum  Device { Console, File, Standard }
 

Logger devices.

More...

Public Member Functions

 WindowsConsole (unsigned int level, const string &title, const string &path)
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

HANDLE childStdInWrite_
PROCESS_INFORMATION childProcess_

Detailed Description

This class implements a Windows console Logger.


Member Enumeration Documentation

enum Device [inherited]

Logger devices.

Enumerator:
Console 

A console window logger.

File 

A file logger.

Standard 

The stdout logger. (Does not work in some platforms.).


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, XtermColour, ForwardToGlobalLogger >.

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

Gets Logger's current level.

Returns:
The level.

Implemented in LoggerImpl< PrefixPolicy, ColourPolicy, SafetyPolicy >.

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

Sets Logger's current level.

Parameters:
level : New level.

Implemented in LoggerImpl< PrefixPolicy, ColourPolicy, 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, ColourPolicy, 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.