LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Member Functions | Protected Attributes | List of all members
lsst::pex::logging::LogDestination Class Reference

an encapsulation of a logging stream that will filter messages based on their volume (importance) level. More...

#include <LogDestination.h>

Inheritance diagram for lsst::pex::logging::LogDestination:
lsst::pex::logging::FileDestination

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 ()
 
LogDestinationoperator= (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
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

Parameters
strmthe output stream to send messages to. If the pointer id null, this LogDestination will act as a null-op destination.
formatterthe LogFormatter to use to format the messages
thresholdthe 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 lsst::pex::logging::LogDestination::~LogDestination ( )
virtual

delete this destination

Member Function Documentation

int lsst::pex::logging::LogDestination::getThreshold ( ) const
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

void lsst::pex::logging::LogDestination::setThreshold ( int  threshold)
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.

106 { _threshold = threshold; }
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.

Returns
true if the record was actually passed to the associated stream.

Member Data Documentation

boost::shared_ptr<LogFormatter> lsst::pex::logging::LogDestination::_frmtr
protected

Definition at line 123 of file LogDestination.h.

std::ostream* lsst::pex::logging::LogDestination::_strm
protected

Definition at line 122 of file LogDestination.h.

int lsst::pex::logging::LogDestination::_threshold
protected

Definition at line 121 of file LogDestination.h.


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