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

More...

`#include <LogSinkInterface.h>`

## Public Member Functions

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

## Protected Attributes

String | taskName

## Private Attributes

LogFilterInterface * | filter_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

- LogMessage
- LogFilterInterface

### 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) {
ref.filter(LogMessage::DEBUGGING);
}
casacore::LogMessage
Definition LogMessage.h:98
casacore::LogMessage::DEBUGGING
@ DEBUGGING
Low priority - primarily used for findding problems or tracing execution.
Definition LogMessage.h:105
casacore::LogSinkInterface::LogSinkInterface
LogSinkInterface()
Create with a NORMAL filter.
casacore::ref
const RecordRep & ref() const
Return a const reference to the underlying RecordRep.

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

- Nothing known.

Definition at line 96 of file LogSinkInterface.h.

## Constructor & Destructor Documentation

## LogSinkInterface() [1/3]

casacore::LogSinkInterface::LogSinkInterface | ( |  | ) |

Create with a NORMAL filter.

Referenced by casacore::LogSink::filter(), filter(), casacore::LogSink::globalSink(), casacore::LogSink::globalSink(), casacore::LogSink::localSink(), casacore::LogSink::localSink(), casacore::LogSink::localSink(), LogSinkInterface(), casacore::LogSink::LsiIntermediate::LsiIntermediate(), casacore::LogSink::LsiIntermediate::operator*(), casacore::LogSink::LsiIntermediate::operator->(), operator=(), and casacore::LogSink::LsiIntermediate::replace().

## LogSinkInterface() [2/3]

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

Create with the supplied filter.

References filter().

## LogSinkInterface() [3/3]

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

Copy semantics - copy the filter from other to this.

References LogSinkInterface().

## ~LogSinkInterface()

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

virtual

## Member Function Documentation

## cerrToo()

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

virtual

Write to cerr too.

## clearLocally()

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

## filter() [1/2]

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

virtual

Get/set the filter.

Reimplemented in casacore::LogSink.

Referenced by filter(), casacore::TableLogSink::id(), LogSinkInterface(), casacore::TableLogSink::makeSink(), casacore::TableLogSink::makeSink(), casacore::MemoryLogSink::MemoryLogSink(), casacore::MemoryLogSink::MemoryLogSink(), casacore::NullLogSink::NullLogSink(), casacore::NullLogSink::NullLogSink(), casacore::TableLogSink::reopenRW(), casacore::StreamLogSink::StreamLogSink(), casacore::StreamLogSink::StreamLogSink(), casacore::TableLogSink::TableLogSink(), and casacore::TableLogSink::TableLogSink().

## filter() [2/2]

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

virtual

Reimplemented in casacore::LogSink.

References filter(), and LogSinkInterface().

## flush()

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

virtual

Write any pending output.

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

References casacore::True.

## getLocation()

virtual String casacore::LogSinkInterface::getLocation | ( | uInt | i | ) | const

virtual

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

## getMessage()

virtual String casacore::LogSinkInterface::getMessage | ( | uInt | i | ) | const

virtual

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

## getObjectID()

virtual String casacore::LogSinkInterface::getObjectID | ( | uInt | i | ) | const

virtual

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

## getPriority()

virtual String casacore::LogSinkInterface::getPriority | ( | uInt | i | ) | const

virtual

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

## getTime()

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

## id()

virtual String casacore::LogSinkInterface::id | ( |  | ) | const

pure virtual

Returns the id of the LogSink in use...

Implemented in casacore::LogSink, casacore::MemoryLogSink, casacore::NullLogSink, casacore::StreamLogSink, and casacore::TableLogSink.

## localId()

String casacore::LogSinkInterface::localId | ( |  | ) |

static

Returns the id for this class...

## nelements()

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

virtual

Get number of messages in sink.

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

## operator=()

LogSinkInterface & casacore::LogSinkInterface::operator= | ( | const LogSinkInterface & |  | ) |

References LogSinkInterface().

## postLocally()

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::MemoryLogSink, casacore::NullLogSink, casacore::StreamLogSink, and casacore::TableLogSink.

## setTaskName()

void casacore::LogSinkInterface::setTaskName | ( | const String & | theTask | ) |

inline

Definition at line 154 of file LogSinkInterface.h.

References taskName.

## writeLocally()

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

References casacore::time().

## Member Data Documentation

## filter_p

LogFilterInterface* casacore::LogSinkInterface::filter_p

private

Definition at line 156 of file LogSinkInterface.h.

## taskName

String casacore::LogSinkInterface::taskName

protected

Definition at line 158 of file LogSinkInterface.h.

Referenced by setTaskName().

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

- casa/Logging/LogSinkInterface.h