Ceylan::Log::Loggable Class Reference

All objects which should be able to log their behaviour should implement this interface. More...

#include <CeylanLoggable.h>

Inheritance diagram for Ceylan::Log::Loggable:

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

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

 Loggable (const std::string &name)
 Constructs a Loggable object whose Log identifier is name.
virtual ~Loggable () throw ()
 Basic virtual destructor, closes the underlying log channel.
void setChannelName (const std::string &channelName)
 Sets this Logable channel name.
bool hasChannelName () const
 Returns whether this Log source has a registered channel name.
std::string getChannelName () const
 Returns this LogSource channel name.
void setLevelOfDetail (LevelOfDetail newLevel)
 Sets this LogSource level of detail of interest.
LevelOfDetail getLevelOfDetail () const
 Returns this LogSource channel name.
virtual void send (const std::string &message, LevelOfDetail levelOfDetail=DefaultLevelOfDetailForMessage)
 Sends message to this LogSource's internal channel, through known LogTransport.
virtual void sendToChannel (const std::string &channel, const std::string &message, LevelOfDetail levelOfDetail=DefaultLevelOfDetailForMessage) const
 Sends message to the specified channel, through known LogTransport.
virtual void setTransport (LogTransport &newTransport)
 Sets a new Log transport for this LogSource.
virtual LogTransportgetTransport () const
 Returns this LogSource's Log transport.
virtual bool hasTransport () const
 Tells whether this LogSource has a registered Log transport.
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 bool IsALoggableChannelName (const std::string &channelName)
 Returns whether the specified channel name is an object channel name, based on the possible presence of the protocol prefix and separators (typically, loggable://).
static const std::string GetEmbeddedChannelName (const std::string &fullChannelName)
 Returns the real channel name used by a Loggable by removing the protocol prefix and separators (typically, 'loggable://').
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.

Static Public Attributes

static const std::string ProtocolName = "loggable"
static const LevelOfDetail DefaultLevelOfDetailForSource = 10
 The default level of detail of a Log source.

Protected Member Functions

virtual void directSend (const std::string &channel, const std::string &message, LevelOfDetail levelOfDetail=DefaultLevelOfDetailForMessage) const
 Internal method to send messages.
virtual void unlinkTransport ()
 Suppresses the link between this LogSource and its Log transport.

Protected Attributes

std::string _channelName
 Stores this LogSource channel name.
LevelOfDetail _level
 The current level of detail of interest for this Log source.
LogTransport_transport
 The LogTransport to be used for sending messages.

Static Protected Attributes

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

Private Member Functions

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


Detailed Description

All objects which should be able to log their behaviour should implement this interface.

A Loggable objet is a LogSource dedicated to an object.

See also:
Log, LogSource

Definition at line 56 of file CeylanLoggable.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

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

Constructs a Loggable object whose Log identifier is name.

Parameters:
name the name of the Loggable which will be used for its private channel.
trackInstance tells whether the created instances's lifecycle is to be watched through the log system (ex: deallocation notice).

Definition at line 46 of file CeylanLoggable.cc.

References setChannelName().

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

Basic virtual destructor, closes the underlying log channel.

Definition at line 56 of file CeylanLoggable.cc.

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

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

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


Member Function Documentation

void LogSource::directSend ( const std::string &  channel,
const std::string &  message,
LevelOfDetail  levelOfDetail = DefaultLevelOfDetailForMessage 
) const [protected, virtual, inherited]

Internal method to send messages.

Filters them out if their level of detail is higher than the one of this log source.

Definition at line 164 of file CeylanLogSource.cc.

References Ceylan::Log::LogSource::_transport, and Ceylan::Log::LogTransport::propagate().

Referenced by Ceylan::Log::LogSource::send(), and Ceylan::Log::LogSource::sendToChannel().

std::string LogSource::getChannelName (  )  const [inherited]

Returns this LogSource channel name.

Definition at line 101 of file CeylanLogSource.cc.

References Ceylan::Log::LogSource::_channelName.

Referenced by Ceylan::Log::LogSource::toString().

const string Loggable::GetEmbeddedChannelName ( const std::string &  fullChannelName  )  [static]

LevelOfDetail LogSource::getLevelOfDetail (  )  const [inherited]

Returns this LogSource channel name.

Definition at line 119 of file CeylanLogSource.cc.

References Ceylan::Log::LogSource::_level.

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

LogTransport * LogSource::getTransport (  )  const [virtual, inherited]

Returns this LogSource's Log transport.

Definition at line 209 of file CeylanLogSource.cc.

References Ceylan::Log::LogSource::_transport.

bool LogSource::hasChannelName (  )  const [inherited]

Returns whether this Log source has a registered channel name.

Definition at line 83 of file CeylanLogSource.cc.

References Ceylan::Log::LogSource::_channelName.

Referenced by Ceylan::Log::LogSource::toString().

bool LogSource::hasTransport (  )  const [virtual, inherited]

Tells whether this LogSource has a registered Log transport.

Definition at line 218 of file CeylanLogSource.cc.

References Ceylan::Log::LogSource::_transport.

Referenced by Ceylan::Log::LogSource::setTransport().

bool Loggable::IsALoggableChannelName ( const std::string &  channelName  )  [static]

Returns whether the specified channel name is an object channel name, based on the possible presence of the protocol prefix and separators (typically, loggable://).

Definition at line 73 of file CeylanLoggable.cc.

References Ceylan::URI::getProtocolName(), ProtocolName, and Ceylan::URI::ProtocolSeparator.

Referenced by Ceylan::Log::LogAggregator::findChannel(), and Ceylan::Log::LogAggregator::store().

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

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

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

void LogSource::send ( const std::string &  message,
LevelOfDetail  levelOfDetail = DefaultLevelOfDetailForMessage 
) [virtual, inherited]

Sends message to this LogSource's internal channel, through known LogTransport.

Parameters:
message the log message to send. Please avoid characters '<' and '>' since they have a special meaning for HTML log output. These characters used to be filtered in HTML aggregators but it prevented messages to contain HTML tags on purpose, which proved to be convenient.
levelOfDetail the level of detail of this message (level 1 by default).
Note:
This method cannot be const since it would do so with Ceylan::Object's one, which has to be non-const because of its possible need to forge an identifier and mutable is not used.
See also:
send with implied internal channel

Reimplemented in Ceylan::Object, and Ceylan::Log::MuteLogSource.

Definition at line 128 of file CeylanLogSource.cc.

References Ceylan::Log::LogSource::_channelName, and Ceylan::Log::LogSource::directSend().

Referenced by Ceylan::Log::LogPlug::CreateBasicPlug(), Ceylan::Log::LogPlug::debug(), Ceylan::Log::LogPlug::error(), Ceylan::Log::LogPlug::fatal(), Ceylan::Log::LogPlug::info(), Ceylan::Log::LogPlug::logroot(), Ceylan::Log::LogPlug::trace(), and Ceylan::Log::LogPlug::warning().

void LogSource::sendToChannel ( const std::string &  channel,
const std::string &  message,
LevelOfDetail  levelOfDetail = DefaultLevelOfDetailForMessage 
) const [virtual, inherited]

Sends message to the specified channel, through known LogTransport.

Note:
This method is to be used when a message is to be sent to a channel different from the LogSource's internal one.
Parameters:
channel the channel name which will identify the targeted Loglistener.
message the log message to send. Please avoid characters '<' and '>' since they have a special meaning for HTML log output. These characters used to be filtered in HTML aggregators but it prevented messages to contain HTML tags on purpose, which proved to be convenient.
levelOfDetail the level of detail of this message (level 1 by default).
See also:
send with implied internal channel

Definition at line 142 of file CeylanLogSource.cc.

References Ceylan::Log::LogSource::_level, CEYLAN_LOG, Ceylan::Log::LogSource::directSend(), and Ceylan::toString().

void Loggable::setChannelName ( const std::string &  channelName  ) 

Sets this Logable channel name.

Reimplemented from Ceylan::Log::LogSource.

Definition at line 63 of file CeylanLoggable.cc.

References ProtocolName, and Ceylan::URI::ProtocolSeparator.

Referenced by Loggable().

void LogSource::setLevelOfDetail ( LevelOfDetail  newLevel  )  [inherited]

Sets this LogSource level of detail of interest.

Definition at line 110 of file CeylanLogSource.cc.

References Ceylan::Log::LogSource::_level.

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

void LogSource::setTransport ( LogTransport newTransport  )  [virtual, inherited]

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 LogSource::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const [virtual, inherited]

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::Object, Ceylan::Log::MuteLogSource, Ceylan::Maths::Random::RandomGenerator, Ceylan::Maths::Random::RandomGeneratorFromPDF, Ceylan::Maths::Random::WhiteNoiseGenerator, Ceylan::Module, and Ceylan::Plugin.

Definition at line 227 of file CeylanLogSource.cc.

References Ceylan::Log::LogSource::_level, Ceylan::Log::LogSource::getChannelName(), Ceylan::Log::LogSource::hasChannelName(), and Ceylan::toNumericalString().

Referenced by Ceylan::Log::LogPlug::ToString().

void LogSource::unlinkTransport (  )  [protected, virtual, inherited]

Suppresses the link between this LogSource and its Log transport.

Definition at line 243 of file CeylanLogSource.cc.

Referenced by Ceylan::Log::LogSource::setTransport(), and Ceylan::Log::LogSource::~LogSource().


Member Data Documentation

std::string Ceylan::Log::LogSource::_channelName [protected, inherited]

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 default level of detail of a Log source.

Definition at line 221 of file CeylanLogSource.h.

const string Loggable::ProtocolName = "loggable" [static]

Definition at line 122 of file CeylanLoggable.h.

Referenced by IsALoggableChannelName(), and setChannelName().


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

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