This is the mother class for every potential sender of Log messages. More...
#include <CeylanLogSource.h>
Public Types | |
enum | TextOutputFormat { rawText, html } |
Defines what text output formats for TextDisplayable instances are available. More... | |
Public Member Functions | |
LogSource (const std::string &name, LevelOfDetail levelOfDetail=DefaultLevelOfDetailForSource) | |
Constructs a LogSource whose channel has for name name, with no registered LogTransport. | |
LogSource (const std::string &name, LogTransport &transport, LevelOfDetail levelOfDetail=DefaultLevelOfDetailForSource) | |
Constructs a LogSource whose channel has for name name, linked to specified LogTransport. | |
LogSource (LogTransport &transport, LevelOfDetail levelOfDetail=DefaultLevelOfDetailForSource) | |
Constructs a LogSource linked to specified LogTransport. | |
virtual | ~LogSource () throw () |
Basic virtual destructor. | |
bool | hasChannelName () const |
Returns whether this Log source has a registered channel name. | |
void | setChannelName (const std::string &channelName) |
Sets this LogSource 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 LogTransport * | getTransport () 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 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 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 | |
LogSource (const LogSource &source) | |
Copy constructor made private to ensure that it will be never called. | |
LogSource & | operator= (const LogSource &source) |
Assignment operator made private to ensure that it will be never called. |
This is the mother class for every potential sender of Log messages.
Its job is to propagate incoming Log messages to the relevant LogListener, through a LogTransport.
Definition at line 63 of file CeylanLogSource.h.
enum Ceylan::TextDisplayable::TextOutputFormat [inherited] |
Defines what text output formats for TextDisplayable instances are available.
Definition at line 124 of file CeylanTextDisplayable.h.
LogSource::LogSource | ( | const std::string & | name, | |
LevelOfDetail | levelOfDetail = DefaultLevelOfDetailForSource | |||
) | [explicit] |
Constructs a LogSource whose channel has for name name, with no registered LogTransport.
Definition at line 44 of file CeylanLogSource.cc.
LogSource::LogSource | ( | const std::string & | name, | |
LogTransport & | transport, | |||
LevelOfDetail | levelOfDetail = DefaultLevelOfDetailForSource | |||
) |
Constructs a LogSource whose channel has for name name, linked to specified LogTransport.
Definition at line 53 of file CeylanLogSource.cc.
LogSource::LogSource | ( | LogTransport & | transport, | |
LevelOfDetail | levelOfDetail = DefaultLevelOfDetailForSource | |||
) | [explicit] |
Constructs a LogSource linked to specified LogTransport.
Definition at line 64 of file CeylanLogSource.cc.
LogSource::~LogSource | ( | ) | throw () [virtual] |
Basic virtual destructor.
Definition at line 74 of file CeylanLogSource.cc.
References unlinkTransport().
Ceylan::Log::LogSource::LogSource | ( | const LogSource & | 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.
void LogSource::directSend | ( | const std::string & | channel, | |
const std::string & | message, | |||
LevelOfDetail | levelOfDetail = DefaultLevelOfDetailForMessage | |||
) | const [protected, virtual] |
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 _transport, and Ceylan::Log::LogTransport::propagate().
Referenced by send(), and sendToChannel().
std::string LogSource::getChannelName | ( | ) | const |
Returns this LogSource channel name.
Definition at line 101 of file CeylanLogSource.cc.
References _channelName.
Referenced by toString().
LevelOfDetail LogSource::getLevelOfDetail | ( | ) | const |
Returns this LogSource channel name.
Definition at line 119 of file CeylanLogSource.cc.
References _level.
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().
LogTransport * LogSource::getTransport | ( | ) | const [virtual] |
Returns this LogSource's Log transport.
Definition at line 209 of file CeylanLogSource.cc.
References _transport.
bool LogSource::hasChannelName | ( | ) | const |
Returns whether this Log source has a registered channel name.
Definition at line 83 of file CeylanLogSource.cc.
References _channelName.
Referenced by toString().
bool LogSource::hasTransport | ( | ) | const [virtual] |
Tells whether this LogSource has a registered Log transport.
Definition at line 218 of file CeylanLogSource.cc.
References _transport.
Referenced by setTransport().
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 LogSource::send | ( | const std::string & | message, | |
LevelOfDetail | levelOfDetail = DefaultLevelOfDetailForMessage | |||
) | [virtual] |
Sends message to this LogSource's internal channel, through known LogTransport.
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). |
Reimplemented in Ceylan::Object, and Ceylan::Log::MuteLogSource.
Definition at line 128 of file CeylanLogSource.cc.
References _channelName, and 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] |
Sends message to the specified channel, through known LogTransport.
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). |
Definition at line 142 of file CeylanLogSource.cc.
References _level, CEYLAN_LOG, directSend(), and Ceylan::toString().
void LogSource::setChannelName | ( | const std::string & | channelName | ) |
Sets this LogSource channel name.
Reimplemented in Ceylan::Log::Loggable.
Definition at line 92 of file CeylanLogSource.cc.
References _channelName.
void LogSource::setLevelOfDetail | ( | LevelOfDetail | newLevel | ) |
Sets this LogSource level of detail of interest.
Definition at line 110 of file CeylanLogSource.cc.
References _level.
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().
void LogSource::setTransport | ( | LogTransport & | newTransport | ) | [virtual] |
Sets a new Log transport for this LogSource.
Definition at line 191 of file CeylanLogSource.cc.
References _transport, hasTransport(), unlinkTransport(), and Ceylan::Log::LogPlug::warning().
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 LogSource::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const [virtual] |
Returns a user-friendly description of the state of this object.
level | the requested verbosity level. |
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 _level, getChannelName(), hasChannelName(), and Ceylan::toNumericalString().
Referenced by Ceylan::Log::LogPlug::ToString().
void LogSource::unlinkTransport | ( | ) | [protected, virtual] |
Suppresses the link between this LogSource and its Log transport.
Definition at line 243 of file CeylanLogSource.cc.
Referenced by setTransport(), and ~LogSource().
std::string Ceylan::Log::LogSource::_channelName [protected] |
Stores this LogSource channel name.
Definition at line 242 of file CeylanLogSource.h.
Referenced by getChannelName(), hasChannelName(), send(), and setChannelName().
LevelOfDetail Ceylan::Log::LogSource::_level [protected] |
The current level of detail of interest for this Log source.
Definition at line 246 of file CeylanLogSource.h.
Referenced by getLevelOfDetail(), sendToChannel(), setLevelOfDetail(), 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().
LogTransport* Ceylan::Log::LogSource::_transport [protected] |
The LogTransport to be used for sending messages.
Definition at line 258 of file CeylanLogSource.h.
Referenced by directSend(), getTransport(), hasTransport(), and setTransport().
const LevelOfDetail Ceylan::Log::LogSource::DefaultLevelOfDetailForSource = 10 [static] |
The default level of detail of a Log source.
Definition at line 221 of file CeylanLogSource.h.