LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
lsst.ctrl.events::EventLog Class Reference

a Log for transmitting log messages as events. More...

#include <EventLog.h>

Inheritance diagram for lsst.ctrl.events::EventLog:
lsst::pex::logging::Log

Public Member Functions

 EventLog (const std::string runId, int sliceId, const std::string hostId="", int threshold=pexLogging::Log::INFO)
 constructor for EventLog. More...
 
 EventLog (const std::string runId, int sliceId, const PropertySet::Ptr &preamble, const std::string hostId="", int threshold=pexLogging::Log::INFO)
 constructor for EventLog. More...
 
virtual ~EventLog ()
 destructor More...
 
int getEventThreshold ()
 
void setEventThreshold (int thres)
 
- Public Member Functions inherited from lsst::pex::logging::Log
 Log (const int threshold=INFO, const std::string &name="")
 
 Log (const std::list< boost::shared_ptr< LogDestination > > &destinations, const lsst::daf::base::PropertySet &preamble, const std::string &name="", const int threshold=INFO, bool defaultShowAll=false)
 
 Log (const Log &parent, const std::string &childName, int threshold=INHERIT_THRESHOLD)
 
 Log (const Log &that)
 
virtual ~Log ()
 
Logoperator= (const Log &that)
 
const std::string & getName () const
 
int getThreshold () const
 
void setThreshold (int threshold)
 
bool sends (int importance) const
 
void resetThreshold ()
 
void setThresholdFor (const std::string &name, int threshold)
 
int getThresholdFor (const std::string &name) const
 
bool willShowAll () const
 
void setShowAll (bool yesno)
 
void resetShowAll ()
 
template<class T >
void addPreambleProperty (const std::string &name, const T &val)
 
template<class T >
void setPreambleProperty (const std::string &name, const T &val)
 
LogcreateChildLog (const std::string &childName, int threshold=INHERIT_THRESHOLD) const
 
void log (int importance, const std::string &message, const lsst::daf::base::PropertySet &properties)
 
template<class T >
void log (int importance, const std::string &message, const std::string &name, const T &val)
 
template<class T >
void log (int importance, const std::string &message, const RecordProperty< T > &prop)
 
void log (int importance, const std::string &message)
 
void log (int importance, const boost::format &message)
 
void logdebug (const std::string &message, const lsst::daf::base::PropertySet &properties)
 
template<class T >
void logdebug (const std::string &message, const std::string &name, const T &val)
 
template<class T >
void logdebug (const std::string &message, const RecordProperty< T > &prop)
 
void logdebug (const std::string &message)
 
void logdebug (const boost::format &message)
 
void info (const std::string &message, const lsst::daf::base::PropertySet &properties)
 
template<class T >
void info (const std::string &message, const std::string &name, const T &val)
 
template<class T >
void info (const std::string &message, const RecordProperty< T > &prop)
 
void info (const std::string &message)
 
void info (const boost::format &message)
 
void warn (const std::string &message, const lsst::daf::base::PropertySet &properties)
 
template<class T >
void warn (const std::string &message, const std::string &name, const T &val)
 
template<class T >
void warn (const std::string &message, const RecordProperty< T > &prop)
 
void warn (const std::string &message)
 
void warn (const boost::format &message)
 
void fatal (const std::string &message, const lsst::daf::base::PropertySet &properties)
 
template<class T >
void fatal (const std::string &message, const std::string &name, const T &val)
 
template<class T >
void fatal (const std::string &message, const RecordProperty< T > &prop)
 
void fatal (const std::string &message)
 
void fatal (const boost::format &message)
 
void format (int importance, const char *fmt,...)
 
void debugf (const char *fmt,...)
 
void infof (const char *fmt,...)
 
void warnf (const char *fmt,...)
 
void fatalf (const char *fmt,...)
 
void send (const LogRecord &record)
 
void addDestination (std::ostream &destination, int threshold)
 
void addDestination (std::ostream &destination, int threshold, const boost::shared_ptr< LogFormatter > &formatter)
 
void addDestination (const boost::shared_ptr< LogDestination > &destination)
 
const
lsst::daf::base::PropertySet
getPreamble ()
 
void markPersistent ()
 
void printThresholds (std::ostream &out)
 
void reset ()
 

Static Public Member Functions

static void createDefaultLog (const std::string runId, int slideId, const std::string hostId="", int threshold=Log::INFO)
 creates a default log More...
 
static void createDefaultLog (const std::string runId, int slideId, const PropertySet::Ptr &preamble, const std::string hostId="", int threshold=Log::INFO)
 
- Static Public Member Functions inherited from lsst::pex::logging::Log
static LoggetDefaultLog ()
 
static void createDefaultLog (const std::list< boost::shared_ptr< LogDestination > > &destinations, const lsst::daf::base::PropertySet &preamble, const std::string &name="", const int threshold=INFO)
 
static void closeDefaultLog ()
 

Static Public Attributes

static const std::string LOGGING_TOPIC = "logging"
 
- Static Public Attributes inherited from lsst::pex::logging::Log
static const int DEBUG
 
static const int INFO
 
static const int WARN
 
static const int INHERIT_THRESHOLD
 
static const int FATAL
 

Private Member Functions

void init (const std::string runId, int sliceId, const PropertySet::Ptr &preamble, const std::string hostId, int threshold)
 
void initThres (int threshold)
 

Private Attributes

pexLogging::LogDestination_log
 
EventFormatter_formatter
 

Additional Inherited Members

- Protected Member Functions inherited from lsst::pex::logging::Log
void _send (int threshold, int importance, const char *fmt, va_list ap)
 
void _format (int importance, const char *fmt, va_list ap)
 
- Static Protected Member Functions inherited from lsst::pex::logging::Log
static void setDefaultLog (Log *deflog)
 
- Protected Attributes inherited from lsst::pex::logging::Log
boost::shared_ptr
< threshold::Memory
_thresholds
 
std::list< boost::shared_ptr
< LogDestination > > 
_destinations
 
lsst::daf::base::PropertySet::Ptr _preamble
 
- Static Protected Attributes inherited from lsst::pex::logging::Log
static LogdefaultLog
 
static const std::string _sep
 

Detailed Description

a Log for transmitting log messages as events.

Definition at line 58 of file EventLog.h.

Constructor & Destructor Documentation

lsst.ctrl.events::EventLog::EventLog ( const std::string  runId,
int  sliceId,
const std::string  hostId = "",
int  threshold = pexLogging::Log::INFO 
)

constructor for EventLog.

Parameters
runIdname of the run
sliceIdthe current slice id
hostIdthe name for this host.
thresholdthreshold of this log. Default is threshold is Log::INFO

Definition at line 64 of file EventLog.cc.

65  : pexLogging::Log(threshold)
66 {
67  PropertySet::Ptr psp;
68  init(runId, sliceId, psp, hostId, threshold);
69 }
void init(const std::string runId, int sliceId, const PropertySet::Ptr &preamble, const std::string hostId, int threshold)
Definition: EventLog.cc:86
boost::shared_ptr< PropertySet > Ptr
Definition: PropertySet.h:90
a place to record messages and descriptions of the state of processing.
Definition: Log.h:154
lsst.ctrl.events::EventLog::EventLog ( const std::string  runId,
int  sliceId,
const PropertySet::Ptr preamble,
const std::string  hostId = "",
int  threshold = pexLogging::Log::INFO 
)

constructor for EventLog.

Parameters
runIdname of the run
sliceIdthe current slice id
preamblea list of PropertySet to include in each log message.
hostIdthe name for this host.
thresholdthreshold of this log. Default is threshold is Log::INFO

Definition at line 78 of file EventLog.cc.

79  : Log(threshold)
80 {
81  init(runId, sliceId, preamble, hostId, threshold);
82 }
void init(const std::string runId, int sliceId, const PropertySet::Ptr &preamble, const std::string hostId, int threshold)
Definition: EventLog.cc:86
Log(const int threshold=INFO, const std::string &name="")
lsst.ctrl.events::EventLog::~EventLog ( )
virtual

destructor

Definition at line 142 of file EventLog.cc.

142  {
143 }

Member Function Documentation

void lsst.ctrl.events::EventLog::createDefaultLog ( const std::string  runId,
int  sliceId,
const std::string  hostId = "",
int  threshold = Log::INFO 
)
static

creates a default log

Parameters
runIdname of the run
sliceIdthe current slice id
hostIdthe name of this host
thresholdthe logging threshold to observe when sending log messages

Definition at line 131 of file EventLog.cc.

131  {
132  PropertySet::Ptr psp;
133  pexLogging::Log::setDefaultLog(new EventLog(runId, sliceId, psp, hostId, threshold));
134 }
static void setDefaultLog(Log *deflog)
boost::shared_ptr< PropertySet > Ptr
Definition: PropertySet.h:90
EventLog(const std::string runId, int sliceId, const std::string hostId="", int threshold=pexLogging::Log::INFO)
constructor for EventLog.
Definition: EventLog.cc:64
void lsst.ctrl.events::EventLog::createDefaultLog ( const std::string  runId,
int  slideId,
const PropertySet::Ptr preamble,
const std::string  hostId = "",
int  threshold = Log::INFO 
)
static

Definition at line 136 of file EventLog.cc.

136  {
137  pexLogging::Log::setDefaultLog(new EventLog(runId, sliceId, preamble, hostId, threshold));
138 }
static void setDefaultLog(Log *deflog)
EventLog(const std::string runId, int sliceId, const std::string hostId="", int threshold=pexLogging::Log::INFO)
constructor for EventLog.
Definition: EventLog.cc:64
int lsst.ctrl.events::EventLog::getEventThreshold ( )
inline

Definition at line 67 of file EventLog.h.

67 { return _log->getThreshold(); }
pexLogging::LogDestination * _log
Definition: EventLog.h:76
void lsst.ctrl.events::EventLog::init ( const std::string  runId,
int  sliceId,
const PropertySet::Ptr preamble,
const std::string  hostId,
int  threshold 
)
private

private method to initialize from each constructor

Definition at line 86 of file EventLog.cc.

87 {
88 
89  initThres(threshold);
90  long int host_len = sysconf(_SC_HOST_NAME_MAX);
91 
92  boost::scoped_array<char> host(new char[host_len]);
93 
94  // if there is no host name specified, make "unknown host" the name
95  if (hostId.size() == 0) {
96  if (gethostname(host.get(), host_len) < 0)
97  std::strcpy(host.get(), "unknown host");
98  } else
99  std::strcpy(host.get(), hostId.c_str());
100 
101  std::string hostName(host.get());
102 
103  // TODO: add preamble to _preamble
104  if (preamble.get() != 0)
105  _preamble = preamble->deepCopy();
106 
107  // this will be added by the Event object
108  // _preamble->add("hostId", hostName);
109  _preamble->add("RUNID", runId);
110  _preamble->add("SLICEID", sliceId);
111 }
lsst::daf::base::PropertySet::Ptr _preamble
Definition: Log.h:690
void initThres(int threshold)
Definition: EventLog.cc:115
void lsst.ctrl.events::EventLog::initThres ( int  threshold)
private

private method to initialize the logging mechanism

Definition at line 115 of file EventLog.cc.

116 {
117  _formatter = new EventFormatter();
118  boost::shared_ptr<pexLogging::LogFormatter> fmtr(_formatter);
119 
121  boost::shared_ptr<pexLogging::LogDestination> dest(_log);
122  _destinations.push_back(dest);
123 }
an encapsulation of a logging stream that will filter messages based on their volume (importance) lev...
EventFormatter * _formatter
Definition: EventLog.h:77
static const int INHERIT_THRESHOLD
Definition: Log.h:183
pexLogging::LogDestination * _log
Definition: EventLog.h:76
std::list< boost::shared_ptr< LogDestination > > _destinations
Definition: Log.h:684
void lsst.ctrl.events::EventLog::setEventThreshold ( int  thres)
inline

Definition at line 69 of file EventLog.h.

69 {_log->setThreshold(thres); }
pexLogging::LogDestination * _log
Definition: EventLog.h:76

Member Data Documentation

EventFormatter* lsst.ctrl.events::EventLog::_formatter
private

Definition at line 77 of file EventLog.h.

pexLogging::LogDestination* lsst.ctrl.events::EventLog::_log
private

Definition at line 76 of file EventLog.h.

const std::string lsst.ctrl.events::EventLog::LOGGING_TOPIC = "logging"
static

Definition at line 60 of file EventLog.h.


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