LSSTApplications
10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
|
an encapsulation of a logging stream that will filter messages based on their volume (importance) level. More...
#include <LogDestination.h>
Public Member Functions | |
LogDestination (std::ostream *strm, const boost::shared_ptr< LogFormatter > &formatter, int threshold=threshold::PASS_ALL) | |
create a destination with a threshold. More... | |
LogDestination (const LogDestination &that) | |
virtual | ~LogDestination () |
LogDestination & | operator= (const LogDestination &that) |
int | getThreshold () const |
void | setThreshold (int threshold) |
bool | write (const LogRecord &rec) |
Protected Attributes | |
int | _threshold |
std::ostream * | _strm |
boost::shared_ptr< LogFormatter > | _frmtr |
an encapsulation of a logging stream that will filter messages based on their volume (importance) level.
Multiple destinations can be added to a Log either at its contruction time or later using one of its addDestination() methods. A LogDestination can be added to multiple Logs; however, actual writing to streams is not synchronized, so the output will get garbled if multiple threads or processes write to the same stream simultaneously.
A LogDestination has its own importance threshold associated with it that is in addition to a Log's threshold. If the threshold of a destination is higher than that associated with its Log, then the destination threshold will override the Log's in preventing message from being recorded. This allows some destinations to be more verbose than others.
Definition at line 64 of file LogDestination.h.
lsst::pex::logging::LogDestination::LogDestination | ( | std::ostream * | strm, |
const boost::shared_ptr< LogFormatter > & | formatter, | ||
int | threshold = threshold::PASS_ALL |
||
) |
create a destination with a threshold.
strm | the output stream to send messages to. If the pointer id null, this LogDestination will act as a null-op destination. |
formatter | the LogFormatter to use to format the messages |
threshold | the minimum volume level required to pass a message to the stream. If not provided, it would be set to 0. |
lsst::pex::logging::LogDestination::LogDestination | ( | const LogDestination & | that | ) |
create a copy
|
virtual |
delete this destination
|
inline |
return the importance threshold associated with this stream.
Definition at line 99 of file LogDestination.h.
LogDestination& lsst::pex::logging::LogDestination::operator= | ( | const LogDestination & | that | ) |
copy a destination into this one
|
inline |
set the importance threshold associated with this stream. If this threshold is higher than the threshold associated with the LogDestination's Log, it will override it.
Definition at line 106 of file LogDestination.h.
bool lsst::pex::logging::LogDestination::write | ( | const LogRecord & | rec | ) |
record a given log record to this destinations output stream. The record will be sent to the stream attached to this class if (a) there is actually an attached stream, (b) there is an attached formatter, and (c) the importance level associated with the record is equal to or greater than the threshold associated with this destination.
|
protected |
Definition at line 123 of file LogDestination.h.
|
protected |
Definition at line 122 of file LogDestination.h.
|
protected |
Definition at line 121 of file LogDestination.h.