Ceylan::Log::LogChannel Class Reference

Log channels are thematic containers for log messages, meant to be used by LogAggregators. More...

#include <CeylanLogChannel.h>

Inheritance diagram for Ceylan::Log::LogChannel:

Inheritance graph
[legend]
Collaboration diagram for Ceylan::Log::LogChannel:

Collaboration graph
[legend]

List of all members.

Public Types

enum  TextOutputFormat { rawText, html }
 Defines what text output formats for TextDisplayable instances are available. More...

Public Member Functions

 LogChannel (const std::string &name)
 Creates a named Log channel.
virtual ~LogChannel () throw ()
 Basic virtual destructor.
virtual void addMessage (LogMessage &message, bool check=true)
 Add a new Log message to this channel.
virtual const std::string getName () const
 Returns this channel's name.
virtual MessageCount getMessageCount () const
 Returns the number of messages this channel currently gathered.
virtual const std::string toString (Ceylan::VerbosityLevels level=Ceylan::high) const
 Returns a user-friendly description of the state of this object.

Static Public Member Functions

static const std::string ToString (std::list< TextDisplayable * > displayables, Ceylan::VerbosityLevels level=Ceylan::high)
 Returns a user-friendly description of this list of pointers to text displayable instances.
static TextOutputFormat GetOutputFormat ()
 Returns the current overall text format to be used by TextDisplayable instances.
static void SetOutputFormat (TextOutputFormat newOutputFormat)
 Sets the current overall text format to be used by TextDisplayable instances.

Protected Attributes

std::string _name
 This channel's name.
std::list< LogMessage * > _messages
 Chronologically-ordered set of messages for this Log channel.

Static Protected Attributes

static TextOutputFormat _OutputFormat = rawText
 The text format to be used currently by TextDisplayable instances.

Private Types

typedef Ceylan::Uint32 MessageCount
 Designates a number of log messages.

Private Member Functions

 LogChannel (const LogChannel &source)
 Copy constructor made private to ensure that it will be never called.
LogChanneloperator= (const LogChannel &source)
 Assignment operator made private to ensure that it will be never called.

Friends

class LogAggregator
 Aggregators must able to access to messages of log channels.
class LogAggregatorHTML
 Necessary, since friend relationships are not inherited apparently.


Detailed Description

Log channels are thematic containers for log messages, meant to be used by LogAggregators.

See also:
LogAggregator

Definition at line 63 of file CeylanLogChannel.h.


Member Typedef Documentation

Designates a number of log messages.

Definition at line 84 of file CeylanLogChannel.h.


Member Enumeration Documentation

Defines what text output formats for TextDisplayable instances are available.

Enumerator:
rawText 
html 

Definition at line 124 of file CeylanTextDisplayable.h.


Constructor & Destructor Documentation

LogChannel::LogChannel ( const std::string &  name  )  [explicit]

Creates a named Log channel.

Definition at line 48 of file CeylanLogChannel.cc.

References CEYLAN_LOG, and Ceylan::toString().

LogChannel::~LogChannel (  )  throw () [virtual]

Basic virtual destructor.

Definition at line 59 of file CeylanLogChannel.cc.

References _messages, _name, CEYLAN_LOG, and Ceylan::toString().

Ceylan::Log::LogChannel::LogChannel ( const LogChannel source  )  [private]

Copy constructor made private to ensure that it will be never called.

The compiler should complain whenever this undefined constructor is called, implicitly or not.


Member Function Documentation

void LogChannel::addMessage ( LogMessage message,
bool  check = true 
) [virtual]

Add a new Log message to this channel.

Note:
this method takes ownership of the specified log message.
Parameters:
message the log message to record
check if true, raises a LogException if this added message's channel does not match this channel.
Exceptions:
LogException if the operation failed.

Reimplemented in Ceylan::Log::ObjectChannel.

Definition at line 81 of file CeylanLogChannel.cc.

References _messages, _name, CEYLAN_LOG, generalUtils::false, Ceylan::Log::LogMessage::getChannelName(), Ceylan::Log::LogMessage::toString(), Ceylan::toString(), and generalUtils::true.

Referenced by Ceylan::Log::LogAggregator::createBasicChannelFrom(), and Ceylan::Log::LogAggregator::transferChannel().

LogChannel::MessageCount LogChannel::getMessageCount (  )  const [virtual]

Returns the number of messages this channel currently gathered.

Definition at line 129 of file CeylanLogChannel.cc.

References _messages.

const string LogChannel::getName (  )  const [virtual]

TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat (  )  [static, inherited]

LogChannel& Ceylan::Log::LogChannel::operator= ( const LogChannel source  )  [private]

Assignment operator made private to ensure that it will be never called.

The compiler should complain whenever this undefined operator is called, implicitly or not.

void TextDisplayable::SetOutputFormat ( TextOutputFormat  newOutputFormat  )  [static, inherited]

Sets the current overall text format to be used by TextDisplayable instances.

Parameters:
newOutputFormat the new output format.

Definition at line 72 of file CeylanTextDisplayable.cc.

References Ceylan::TextDisplayable::_OutputFormat.

Referenced by Ceylan::Log::LogHolder::LogHolder().

const std::string TextDisplayable::ToString ( std::list< TextDisplayable * >  displayables,
Ceylan::VerbosityLevels  level = Ceylan::high 
) [static, inherited]

Returns a user-friendly description of this list of pointers to text displayable instances.

Parameters:
displayables a list of pointers to TextDisplayable instances/
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
toString, Ceylan::VerbosityLevels

Definition at line 45 of file CeylanTextDisplayable.cc.

References Ceylan::formatStringList().

const string LogChannel::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const [virtual]

Returns a user-friendly description of the state of this object.

Parameters:
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
TextDisplayable

Implements Ceylan::TextDisplayable.

Reimplemented in Ceylan::Log::ObjectChannel.

Definition at line 143 of file CeylanLogChannel.cc.

References _messages, _name, CEYLAN_LOG, Ceylan::formatStringList(), and Ceylan::low.

Referenced by Ceylan::Log::LogAggregator::transferChannel(), Ceylan::Log::LogAggregatorRaw::write(), Ceylan::Log::LogAggregatorHTML::write(), and Ceylan::Log::LogAggregatorConsole::write().


Friends And Related Function Documentation

friend class LogAggregator [friend]

Aggregators must able to access to messages of log channels.

Definition at line 72 of file CeylanLogChannel.h.

friend class LogAggregatorHTML [friend]

Necessary, since friend relationships are not inherited apparently.

Definition at line 80 of file CeylanLogChannel.h.


Member Data Documentation

std::string Ceylan::Log::LogChannel::_name [protected]

TextDisplayable::TextOutputFormat TextDisplayable::_OutputFormat = rawText [static, protected, inherited]

The text format to be used currently by TextDisplayable instances.

Note:
Defaults to raw text.

Definition at line 158 of file CeylanTextDisplayable.h.

Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().


The documentation for this class was generated from the following files:

Generated on Thu Jun 4 20:40:25 2009 for Ceylan by  doxygen 1.5.8