casacore
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members

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...
 
StreamLogSinkoperator= (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...
 
LogSinkInterfaceoperator= (const LogSinkInterface &)
 
virtual ~LogSinkInterface ()
 
virtual const LogFilterInterfacefilter () const
 Get/set the filter. More...
 
virtual LogSinkInterfacefilter (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
 

Detailed Description

Send log messages to an ostream.

Intended use:

Internal

Review Status

Reviewed By:
wbrouw
Date Reviewed:
1996/08/21
Test programs:
tLogging
Demo programs:
dLogging

Prerequisite

Etymology

"Stream" from the family of standard C++ I/O classes.

Synopsis

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.

Example

See (see (file="Logging.h"))Logging.h.

Motivation

Writing to standard output or error will be a common way of displaying log messages.

To Do

Definition at line 80 of file StreamLogSink.h.

Constructor & Destructor Documentation

◆ StreamLogSink() [1/4]

casacore::StreamLogSink::StreamLogSink ( ostream *  theStream = 0,
bool  deleteStream = false 
)
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.

◆ StreamLogSink() [2/4]

casacore::StreamLogSink::StreamLogSink ( LogMessage::Priority  filter,
ostream *  theStream = 0,
bool  deleteStream = false 
)
explicit

◆ StreamLogSink() [3/4]

casacore::StreamLogSink::StreamLogSink ( const LogFilterInterface filter,
ostream *  theStream = 0,
bool  deleteStream = false 
)
explicit

◆ StreamLogSink() [4/4]

casacore::StreamLogSink::StreamLogSink ( const StreamLogSink other)

Make a copy of other.

After copying, both objects will post to the same stream.

◆ ~StreamLogSink()

casacore::StreamLogSink::~StreamLogSink ( )

Member Function Documentation

◆ flush()

virtual void casacore::StreamLogSink::flush ( Bool  global = True)
virtual

write any pending output.

Reimplemented from casacore::LogSinkInterface.

◆ id()

String casacore::StreamLogSink::id ( ) const
virtual

Returns the id of the LogSink in use...

Implements casacore::LogSinkInterface.

◆ localId()

static String casacore::StreamLogSink::localId ( )
static

Returns the id for this class...

◆ operator=()

StreamLogSink& casacore::StreamLogSink::operator= ( const StreamLogSink other)

◆ postLocally()

virtual Bool casacore::StreamLogSink::postLocally ( const LogMessage message)
virtual

Write message to the stream if it passes the filter.

Works by calling operator<<(ostream &,const LogMesssage&).

Implements casacore::LogSinkInterface.

Member Data Documentation

◆ deleteStream

bool casacore::StreamLogSink::deleteStream
private

Definition at line 117 of file StreamLogSink.h.

◆ stream_p

ostream* casacore::StreamLogSink::stream_p
private

Definition at line 116 of file StreamLogSink.h.


The documentation for this class was generated from the following file: