This class encapsulates the concept of Log message. More...
#include <CeylanLogMessage.h>
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 ×tamp) | |
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 Timestamp & | getTimestamp () 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. | |
LogMessage & | operator= (const LogMessage &source) |
Assignment operator made private to ensure that it will be never called. |
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.
enum Ceylan::TextDisplayable::TextOutputFormat [inherited] |
Defines what text output formats for TextDisplayable instances are available.
Definition at line 124 of file CeylanTextDisplayable.h.
LogMessage::LogMessage | ( | const std::string & | message, | |
const std::string & | channelName, | |||
LevelOfDetail | levelOfDetail, | |||
const Timestamp & | timestamp | |||
) |
Constructor for a Log messsage.
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.
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.
const std::string LogMessage::getChannelName | ( | ) | const [virtual] |
Returns this message's channel.
Definition at line 118 of file CeylanLogMessage.cc.
References _channelName.
Referenced by Ceylan::Log::ObjectChannel::addMessage(), Ceylan::Log::LogChannel::addMessage(), Ceylan::Log::LogAggregator::createBasicChannelFrom(), Ceylan::Log::LogAggregator::createLoggableChannelFrom(), Ceylan::Log::LogAggregator::createObjectChannel(), Ceylan::Log::LogAggregator::demangle(), Ceylan::Log::LogAggregator::store(), Ceylan::Log::LogAggregator::storeBasicMessage(), and Ceylan::Log::LogAggregator::storeObjectMessage().
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] |
Returns the current overall text format to be used by TextDisplayable instances.
Definition at line 63 of file CeylanTextDisplayable.cc.
References Ceylan::TextDisplayable::_OutputFormat.
Referenced by Ceylan::formatStringList(), Ceylan::formatStringMap(), Ceylan::XML::XMLMarkup::toString(), Ceylan::Maths::Linear::Vector3::toString(), Ceylan::Maths::Linear::Vector2::toString(), Ceylan::Maths::Linear::Tripoint::toString(), Ceylan::Module::toString(), Ceylan::Maths::Linear::Matrix3::toString(), Ceylan::Maths::Linear::Matrix2::toString(), Ceylan::Maths::Linear::HomogeneousMatrix3::toString(), and Ceylan::Maths::Linear::Bipoint::toString().
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.
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.
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.
displayables | a list of pointers to TextDisplayable instances/ | |
level | the requested verbosity level. |
Definition at line 45 of file CeylanTextDisplayable.cc.
References Ceylan::formatStringList().
const string LogMessage::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const [virtual] |
Returns a user-friendly description of the state of this object.
Mainly for log debugging purpose:
Implements Ceylan::TextDisplayable.
Definition at line 182 of file CeylanLogMessage.cc.
References _channelName, _levelOfDetail, _message, _timestamp, Ceylan::formatStringList(), Ceylan::low, Ceylan::toNumericalString(), and Ceylan::Timestamp::toString().
Referenced by Ceylan::Log::LogChannel::addMessage(), Ceylan::Log::LogAggregatorRaw::store(), Ceylan::Log::LogAggregatorHTML::store(), Ceylan::Log::LogAggregatorConsole::store(), Ceylan::Log::LogAggregator::store(), Ceylan::Log::LogAggregator::transferChannel(), Ceylan::Log::LogAggregatorRaw::write(), Ceylan::Log::LogAggregatorHTML::write(), and Ceylan::Log::LogAggregatorConsole::write().
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().
LevelOfDetail Ceylan::Log::LogMessage::_levelOfDetail [protected] |
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.
Definition at line 158 of file CeylanTextDisplayable.h.
Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().
const Timestamp* Ceylan::Log::LogMessage::_timestamp [protected] |
This Log message's timestamp.
Definition at line 178 of file CeylanLogMessage.h.
Referenced by getPreformattedText(), getTimestamp(), LogMessage(), toString(), and ~LogMessage().