Loading...
Searching...
No Matches
casacore::StreamLogSink Class Reference
casa package (libcasa_casa) » Logging_module » Logging_module_internal_classes

More...

`#include <StreamLogSink.h>`

## Public Member Functions

| StreamLogSink (ostream *theStream=0, bool deleteStream=false)
| Defaults to cerr if no stream is supplied.
| 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.
StreamLogSink & | operator= (const StreamLogSink &other)
| ~StreamLogSink ()
virtual Bool | postLocally (const LogMessage &message)
| Write message to the stream if it passes the filter.
virtual void | flush (Bool global=True)
| write any pending output.
String | id () const
| Returns the id of the LogSink in use...
Public Member Functions inherited from casacore::LogSinkInterface
| 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 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 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...
Static Public Member Functions inherited from casacore::LogSinkInterface
static String | localId ()
| Returns the id for this class...

## 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

- LogSinkInterface
- ostream

### 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

- Nothing known.

Definition at line 77 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.

References deleteStream.

Referenced by operator=(), and StreamLogSink().

## StreamLogSink() [2/4]

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

explicit

References deleteStream, and casacore::LogSinkInterface::filter().

## StreamLogSink() [3/4]

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

explicit

References deleteStream, and casacore::LogSinkInterface::filter().

## StreamLogSink() [4/4]

casacore::StreamLogSink::StreamLogSink | ( | const StreamLogSink & | other | ) |

Make a copy of other.

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

References StreamLogSink().

## ~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.

References casacore::True.

## id()

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

virtual

Returns the id of the LogSink in use...

Implements casacore::LogSinkInterface.

## localId()

String casacore::StreamLogSink::localId | ( |  | ) |

static

Returns the id for this class...

## operator=()

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

References StreamLogSink().

## 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 114 of file StreamLogSink.h.

Referenced by StreamLogSink(), StreamLogSink(), and StreamLogSink().

## stream_p

ostream* casacore::StreamLogSink::stream_p

private

Definition at line 113 of file StreamLogSink.h.

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

- casa/Logging/StreamLogSink.h