casa
$Rev:20696$
|
Accepts LogMessages and posts them to some destination. More...
#include <LogSinkInterface.h>
Public Member Functions | |
LogSinkInterface () | |
Create with a NORMAL filter. | |
LogSinkInterface (const LogFilterInterface &filter) | |
Create with the supplied filter . | |
LogSinkInterface (const LogSinkInterface &other) | |
Copy semantics - copy the filter from other to this | |
LogSinkInterface & | operator= (const LogSinkInterface &) |
virtual | ~LogSinkInterface () |
virtual const LogFilterInterface & | filter () const |
Get/set the filter. | |
virtual LogSinkInterface & | filter (const LogFilterInterface &filter) |
virtual uInt | nelements () const |
Get number of messages in sink. | |
virtual Double | getTime (uInt i) const |
Get given part of the i-th message from the sink. | |
virtual String | getPriority (uInt i) const |
virtual String | getMessage (uInt i) const |
virtual String | getLocation (uInt i) const |
virtual String | getObjectID (uInt i) const |
virtual Bool | postLocally (const LogMessage &message)=0 |
This function must be over-ridden in derived classes. | |
virtual void | flush (Bool global=True) |
Write any pending output. | |
virtual void | writeLocally (Double time, const String &message, const String &priority, const String &location, const String &objectID) |
Write a message (usually from another logsink) into the local one. | |
virtual void | clearLocally () |
Clear the local sink (i.e. | |
virtual String | id () const =0 |
Returns the id of the LogSink in use... | |
virtual void | cerrToo (bool cerr2) |
Write to cerr too. | |
void | setTaskName (const String &theTask) |
Static Public Member Functions | |
static String | localId () |
Returns the id for this class... | |
Protected Attributes | |
String | taskName |
Private Attributes | |
LogFilterInterface * | filter_p |
Accepts LogMessages and posts them to some destination.
Internal
Log as in "Log Book." Sink from its common usage ("source/sink") as a thing which can accept some substance or energy. Interface because this is an abstract, not concrete, class.
This abstract base class is not intended for applications programmers. Instead they should look at LogSink .
This class defines a minimal "posting" interface for all objects which accept log messages. The fundamental model of a LogSinkInterface
is:
There is no notion of local vs global sinks - that is imposed by LogSink
.
LogSinkInterface &ref = ...; LogMessage message(...); ref.postLocally(message); if (ref.filter().lowestPriority() != LogMessage::DEBUGGING) { ref.filter(LogMessage::DEBUGGING); }
For a more complete example see (see (file="Logging.h"))Logging.h .
Make it straightforward to extend the number of places a message may be in the future through derivation.
Definition at line 99 of file LogSinkInterface.h.
Create with a NORMAL
filter.
casa::LogSinkInterface::LogSinkInterface | ( | const LogFilterInterface & | filter | ) |
Create with the supplied filter
.
casa::LogSinkInterface::LogSinkInterface | ( | const LogSinkInterface & | other | ) |
Copy semantics - copy the filter from other
to this
virtual casa::LogSinkInterface::~LogSinkInterface | ( | ) | [virtual] |
virtual void casa::LogSinkInterface::cerrToo | ( | bool | cerr2 | ) | [virtual] |
Write to cerr too.
virtual void casa::LogSinkInterface::clearLocally | ( | ) | [virtual] |
Clear the local sink (i.e.
remove all messages from it). The default implementation does nothing.
Reimplemented in casa::LogSink, casa::TableLogSink, and casa::MemoryLogSink.
virtual const LogFilterInterface& casa::LogSinkInterface::filter | ( | ) | const [virtual] |
Get/set the filter.
Reimplemented in casa::LogSink.
virtual LogSinkInterface& casa::LogSinkInterface::filter | ( | const LogFilterInterface & | filter | ) | [virtual] |
Reimplemented in casa::LogSink.
virtual void casa::LogSinkInterface::flush | ( | Bool | global = True | ) | [virtual] |
Write any pending output.
Reimplemented in casa::LogSink, casa::TableLogSink, and casa::StreamLogSink.
virtual String casa::LogSinkInterface::getLocation | ( | uInt | i | ) | const [virtual] |
Reimplemented in casa::LogSink, casa::TableLogSink, and casa::MemoryLogSink.
virtual String casa::LogSinkInterface::getMessage | ( | uInt | i | ) | const [virtual] |
Reimplemented in casa::LogSink, casa::TableLogSink, and casa::MemoryLogSink.
virtual String casa::LogSinkInterface::getObjectID | ( | uInt | i | ) | const [virtual] |
Reimplemented in casa::LogSink, casa::TableLogSink, and casa::MemoryLogSink.
virtual String casa::LogSinkInterface::getPriority | ( | uInt | i | ) | const [virtual] |
Reimplemented in casa::LogSink, casa::TableLogSink, and casa::MemoryLogSink.
virtual Double casa::LogSinkInterface::getTime | ( | uInt | i | ) | const [virtual] |
Get given part of the i-th message from the sink.
Reimplemented in casa::LogSink, casa::TableLogSink, and casa::MemoryLogSink.
virtual String casa::LogSinkInterface::id | ( | ) | const [pure virtual] |
Returns the id of the LogSink in use...
Implemented in casa::LogSink, casa::TableLogSink, casa::MemoryLogSink, casa::StreamLogSink, and casa::NullLogSink.
static String casa::LogSinkInterface::localId | ( | ) | [static] |
Returns the id for this class...
Reimplemented in casa::LogSink, casa::TableLogSink, casa::MemoryLogSink, casa::StreamLogSink, and casa::NullLogSink.
virtual uInt casa::LogSinkInterface::nelements | ( | ) | const [virtual] |
Get number of messages in sink.
Reimplemented in casa::LogSink, casa::TableLogSink, and casa::MemoryLogSink.
LogSinkInterface& casa::LogSinkInterface::operator= | ( | const LogSinkInterface & | ) |
virtual Bool casa::LogSinkInterface::postLocally | ( | const LogMessage & | message | ) | [pure virtual] |
This function must be over-ridden in derived classes.
If the filter passes the message, do what is necessary with the message and return True
.
Implemented in casa::LogSink, casa::TableLogSink, casa::StreamLogSink, casa::MemoryLogSink, and casa::NullLogSink.
void casa::LogSinkInterface::setTaskName | ( | const String & | theTask | ) | [inline] |
Definition at line 157 of file LogSinkInterface.h.
References taskName.
virtual void casa::LogSinkInterface::writeLocally | ( | Double | time, |
const String & | message, | ||
const String & | priority, | ||
const String & | location, | ||
const String & | objectID | ||
) | [virtual] |
Write a message (usually from another logsink) into the local one.
The default implementation does nothing.
Reimplemented in casa::LogSink, casa::TableLogSink, and casa::MemoryLogSink.
Definition at line 159 of file LogSinkInterface.h.
String casa::LogSinkInterface::taskName [protected] |
Definition at line 161 of file LogSinkInterface.h.
Referenced by setTaskName().