Ceylan::Log::LogMessage Class Reference

This class encapsulates the concept of Log message. More...

#include <CeylanLogMessage.h>

Inheritance diagram for Ceylan::Log::LogMessage:
Inheritance graph
[legend]
Collaboration diagram for Ceylan::Log::LogMessage:
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

 LogMessage (const std::string &message, const std::string &channelName, LevelOfDetail levelOfDetail, const Timestamp &timestamp)
 Constructor for a Log messsage.
 LogMessage (const std::string &message, const std::string &channelName, LevelOfDetail levelOfDetail=MaximumLevelOfDetailForMessage)
 Simpler LogMessage constructor, whose timestamp is dated from this LogMessage creation.
virtual ~LogMessage () throw ()
 Basic virtual destructor.
virtual const std::string getContent () const
 Returns this message's actual content.
virtual const std::string getChannelName () const
 Returns this message's channel.
virtual void setChannelName (const std::string &newChannelName)
 Sets this message's channel name to newChannelName.
virtual LevelOfDetail getLevelOfDetail () const
 Returns this message's level of detail.
virtual const TimestampgetTimestamp () const
 Returns this message's timestamp, but keep ownership of it.
virtual const std::string getPreformattedText () const
 Returns a user-friendly pre-formatted text of this log message.
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 _message
 The Log message itself.
std::string _channelName
 The Log message channel name.
LevelOfDetail _levelOfDetail
 This Log message's level of detail.
const Timestamp_timestamp
 This Log message's timestamp.

Static Protected Attributes

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

Private Member Functions

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

Detailed Description

This class encapsulates the concept of Log message.

On future versions, a Log message could carry a content, which could be a string or anything else, thanks to Ceylan::Log::LogContent.

Definition at line 58 of file CeylanLogMessage.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

LogMessage::LogMessage ( const std::string &  message,
const std::string &  channelName,
LevelOfDetail  levelOfDetail,
const Timestamp timestamp 
)

Constructor for a Log messsage.

Parameters:
message the log message itself.
channelName the name of the channel this message belongs to.
levelOfDetail this message's level of detail.
timestamp a timesptamp to record when this message was emitted. The Log message takes ownership of the timestamp.

Definition at line 49 of file CeylanLogMessage.cc.

References CEYLAN_LOG, and Ceylan::toString().

LogMessage::LogMessage ( const std::string &  message,
const std::string &  channelName,
LevelOfDetail  levelOfDetail = MaximumLevelOfDetailForMessage 
)

Simpler LogMessage constructor, whose timestamp is dated from this LogMessage creation.

Exceptions:
LogException,since timestamp creation may fail.

Definition at line 66 of file CeylanLogMessage.cc.

References _timestamp, CEYLAN_LOG, dataUtils::e, Ceylan::Exception::toString(), and Ceylan::toString().

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

Basic virtual destructor.

Definition at line 97 of file CeylanLogMessage.cc.

References _timestamp, CEYLAN_LOG, and Ceylan::toString().

Ceylan::Log::LogMessage::LogMessage ( const LogMessage 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

const std::string LogMessage::getChannelName (  )  const [virtual]
const std::string LogMessage::getContent (  )  const [virtual]

Returns this message's actual content.

Definition at line 109 of file CeylanLogMessage.cc.

References _message.

LevelOfDetail LogMessage::getLevelOfDetail (  )  const [virtual]

Returns this message's level of detail.

Definition at line 136 of file CeylanLogMessage.cc.

References _levelOfDetail.

Referenced by Ceylan::Log::LogAggregator::getMessageVerbosityLevel().

TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat (  )  [static, inherited]
const string LogMessage::getPreformattedText (  )  const [virtual]

Returns a user-friendly pre-formatted text of this log message.

Definition at line 162 of file CeylanLogMessage.cc.

References _levelOfDetail, _message, _timestamp, Ceylan::toNumericalString(), and Ceylan::Timestamp::toString().

Referenced by Ceylan::Log::LogAggregatorHTML::write().

const Timestamp & LogMessage::getTimestamp (  )  const [virtual]

Returns this message's timestamp, but keep ownership of it.

Exceptions:
LogException if the operation fails.

Definition at line 145 of file CeylanLogMessage.cc.

References _timestamp.

LogMessage& Ceylan::Log::LogMessage::operator= ( const LogMessage 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 LogMessage::setChannelName ( const std::string &  newChannelName  )  [virtual]

Sets this message's channel name to newChannelName.

Definition at line 127 of file CeylanLogMessage.cc.

References _channelName.

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

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

Member Data Documentation

std::string Ceylan::Log::LogMessage::_channelName [protected]

The Log message channel name.

Definition at line 170 of file CeylanLogMessage.h.

Referenced by getChannelName(), setChannelName(), and toString().

This Log message's level of detail.

Definition at line 174 of file CeylanLogMessage.h.

Referenced by getLevelOfDetail(), getPreformattedText(), and toString().

std::string Ceylan::Log::LogMessage::_message [protected]

The Log message itself.

Definition at line 166 of file CeylanLogMessage.h.

Referenced by getContent(), getPreformattedText(), and toString().

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

This Log message's timestamp.

Definition at line 178 of file CeylanLogMessage.h.

Referenced by getPreformattedText(), getTimestamp(), LogMessage(), toString(), and ~LogMessage().


The documentation for this class was generated from the following files:
Generated on Mon Nov 29 13:41:08 2010 for Ceylan by  doxygen 1.6.3