StreamLogSink.h

Classes

StreamLogSink -- Send log messages to an ostream. (full description)

class StreamLogSink : public LogSinkInterface

Interface

Public Members
explicit StreamLogSink(ostream *theStream = 0)
explicit StreamLogSink(LogMessage::Priority filter, ostream *theStream = 0)
explicit StreamLogSink(const LogFilterInterface &filter, ostream *theStream = 0)
StreamLogSink(const StreamLogSink &other)
StreamLogSink &operator=(const StreamLogSink &other)
~StreamLogSink()
virtual Bool postLocally(const LogMessage &message)
virtual void flush (Bool global=True)
static String localId( )
String id( ) const

Description

Review Status

Reviewed By:
wbrouw
Date Reviewed:
1996/08/21
Programs:
Demos:
Tests:

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 Logging.h.

Motivation

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

To Do

Member Description

explicit StreamLogSink(ostream *theStream = 0)
explicit StreamLogSink(LogMessage::Priority filter, ostream *theStream = 0)
explicit StreamLogSink(const LogFilterInterface &filter, ostream *theStream = 0)

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(const StreamLogSink &other)
StreamLogSink &operator=(const StreamLogSink &other)

Make a copy of other. After copying, both objects will post to the same stream.

~StreamLogSink()

virtual Bool postLocally(const LogMessage &message)

Write message to the stream if it passes the filter. Works by calling operator<<(ostream &,const LogMesssage&).

virtual void flush (Bool global=True)

write any pending output.

static String localId( )

Returns the id for this class...

String id( ) const

Returns the id of the LogSink in use...