casacore
|
Send log messages to an ostream. More...
#include <StreamLogSink.h>
Public Member Functions | |
StreamLogSink (ostream *theStream=0, bool deleteStream=false) | |
Defaults to cerr if no stream is supplied. More... | |
StreamLogSink (LogMessage::Priority filter, ostream *theStream=0, bool deleteStream=false) | |
StreamLogSink (const LogFilterInterface &filter, ostream *theStream=0, bool deleteStream=false) | |
StreamLogSink (const StreamLogSink &other) | |
Make a copy of other . More... | |
StreamLogSink & | operator= (const StreamLogSink &other) |
~StreamLogSink () | |
virtual Bool | postLocally (const LogMessage &message) |
Write message to the stream if it passes the filter. More... | |
virtual void | flush (Bool global=True) |
write any pending output. More... | |
String | id () const |
Returns the id of the LogSink in use... More... | |
Public Member Functions inherited from casacore::LogSinkInterface | |
LogSinkInterface () | |
Create with a NORMAL filter. More... | |
LogSinkInterface (const LogFilterInterface &filter) | |
Create with the supplied filter . More... | |
LogSinkInterface (const LogSinkInterface &other) | |
Copy semantics - copy the filter from other to this More... | |
LogSinkInterface & | operator= (const LogSinkInterface &) |
virtual | ~LogSinkInterface () |
virtual const LogFilterInterface & | filter () const |
Get/set the filter. More... | |
virtual LogSinkInterface & | filter (const LogFilterInterface &filter) |
virtual uInt | nelements () const |
Get number of messages in sink. More... | |
virtual Double | getTime (uInt i) const |
Get given part of the i-th message from the sink. More... | |
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 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. More... | |
virtual void | clearLocally () |
Clear the local sink (i.e. More... | |
virtual void | cerrToo (bool cerr2) |
Write to cerr too. More... | |
void | setTaskName (const String &theTask) |
Static Public Member Functions | |
static String | localId () |
Returns the id for this class... More... | |
Static Public Member Functions inherited from casacore::LogSinkInterface | |
static String | localId () |
Returns the id for this class... More... | |
Private Attributes | |
ostream * | stream_p |
bool | deleteStream |
Additional Inherited Members | |
Protected Attributes inherited from casacore::LogSinkInterface | |
String | taskName |
Send log messages to an ostream.
Internal
"Stream" from the family of standard C++ I/O classes.
StreamLogSink
is a straightforward LogSinkInterface which sends its messages to an ostream
(typically cerr
) which it is given at construction time. It is not intended to be used directly, rather it should be used through LogSink.
See (see (file="Logging.h"))Logging.h.
Writing to standard output or error will be a common way of displaying log messages.
Definition at line 80 of file StreamLogSink.h.
|
explicit |
Defaults to cerr
if no stream is supplied.
The caller is responsible for ensuring that the supplied ostream
ostream lives at least as long as this sink. If not filter is supplied, NORMAL
is used.
|
explicit |
|
explicit |
casacore::StreamLogSink::StreamLogSink | ( | const StreamLogSink & | other | ) |
Make a copy of other
.
After copying, both objects will post to the same stream.
casacore::StreamLogSink::~StreamLogSink | ( | ) |
write any pending output.
Reimplemented from casacore::LogSinkInterface.
|
virtual |
Returns the id of the LogSink in use...
Implements casacore::LogSinkInterface.
|
static |
Returns the id for this class...
StreamLogSink& casacore::StreamLogSink::operator= | ( | const StreamLogSink & | other | ) |
|
virtual |
Write message
to the stream if it passes the filter.
Works by calling operator<<(ostream &,const LogMesssage&)
.
Implements casacore::LogSinkInterface.
|
private |
Definition at line 117 of file StreamLogSink.h.
|
private |
Definition at line 116 of file StreamLogSink.h.