casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Attributes | List of all members
casacore::LogSinkInterface Class Referenceabstract

Accepts LogMessages and posts them to some destination. More...

#include <LogSinkInterface.h>

Inheritance diagram for casacore::LogSinkInterface:
casacore::LogSink casacore::MemoryLogSink casacore::NullLogSink casacore::StreamLogSink casacore::TableLogSink

Public Member Functions

 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 Bool postLocally (const LogMessage &message)=0
 This function must be over-ridden in derived classes. More...
 
virtual void flush (Bool global=True)
 Write any pending output. More...
 
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 String id () const =0
 Returns the id of the LogSink in use... 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...
 

Protected Attributes

String taskName
 

Private Attributes

LogFilterInterfacefilter_p
 

Detailed Description

Accepts LogMessages and posts them to some destination.

Intended use:

Internal

Review Status

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

Prerequisite

Etymology

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.

Synopsis

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:

  1. That it contains a LogFilterInterface that is used to accept or reject messages; and
  2. That it has a post message that takes a log message; and, if it passes the filter, does something with it (prints it to a stream, saves it to a table,...).

There is no notion of local vs global sinks - that is imposed by LogSink.

Example

LogSinkInterface &ref =...;
LogMessage message(...);
ref.postLocally(message);
if (ref.filter().lowestPriority() != LogMessage::DEBUGGING) {
}

For a more complete example see (see (file="Logging.h"))Logging.h.

Motivation

Make it straightforward to extend the number of places a message may be in the future through derivation.

To Do

Definition at line 99 of file LogSinkInterface.h.

Constructor & Destructor Documentation

casacore::LogSinkInterface::LogSinkInterface ( )

Create with a NORMAL filter.

casacore::LogSinkInterface::LogSinkInterface ( const LogFilterInterface filter)

Create with the supplied filter.

casacore::LogSinkInterface::LogSinkInterface ( const LogSinkInterface other)

Copy semantics - copy the filter from other to this

virtual casacore::LogSinkInterface::~LogSinkInterface ( )
virtual

Member Function Documentation

virtual void casacore::LogSinkInterface::cerrToo ( bool  cerr2)
virtual

Write to cerr too.

virtual void casacore::LogSinkInterface::clearLocally ( )
virtual

Clear the local sink (i.e.

remove all messages from it). The default implementation does nothing.

Reimplemented in casacore::LogSink, casacore::TableLogSink, and casacore::MemoryLogSink.

virtual const LogFilterInterface& casacore::LogSinkInterface::filter ( ) const
virtual

Get/set the filter.

Reimplemented in casacore::LogSink.

virtual LogSinkInterface& casacore::LogSinkInterface::filter ( const LogFilterInterface filter)
virtual

Reimplemented in casacore::LogSink.

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

Write any pending output.

Reimplemented in casacore::LogSink, casacore::TableLogSink, and casacore::StreamLogSink.

virtual String casacore::LogSinkInterface::getLocation ( uInt  i) const
virtual
virtual String casacore::LogSinkInterface::getMessage ( uInt  i) const
virtual
virtual String casacore::LogSinkInterface::getObjectID ( uInt  i) const
virtual
virtual String casacore::LogSinkInterface::getPriority ( uInt  i) const
virtual
virtual Double casacore::LogSinkInterface::getTime ( uInt  i) const
virtual

Get given part of the i-th message from the sink.

Reimplemented in casacore::LogSink, casacore::TableLogSink, and casacore::MemoryLogSink.

virtual String casacore::LogSinkInterface::id ( ) const
pure virtual
static String casacore::LogSinkInterface::localId ( )
static

Returns the id for this class...

virtual uInt casacore::LogSinkInterface::nelements ( ) const
virtual

Get number of messages in sink.

Reimplemented in casacore::LogSink, casacore::TableLogSink, and casacore::MemoryLogSink.

LogSinkInterface& casacore::LogSinkInterface::operator= ( const LogSinkInterface )
virtual Bool casacore::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 casacore::LogSink, casacore::TableLogSink, casacore::StreamLogSink, casacore::MemoryLogSink, and casacore::NullLogSink.

void casacore::LogSinkInterface::setTaskName ( const String theTask)
inline

Definition at line 157 of file LogSinkInterface.h.

References taskName.

virtual void casacore::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 casacore::LogSink, casacore::TableLogSink, and casacore::MemoryLogSink.

Member Data Documentation

LogFilterInterface* casacore::LogSinkInterface::filter_p
private

Definition at line 159 of file LogSinkInterface.h.

String casacore::LogSinkInterface::taskName
protected

Definition at line 161 of file LogSinkInterface.h.

Referenced by setTaskName().


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