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 | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | List of all members
lsst::pex::logging::Log Class Reference

a place to record messages and descriptions of the state of processing. More...

#include <Log.h>

Inheritance diagram for lsst::pex::logging::Log:
lsst::pex::logging::BlockTimingLog lsst::pex::logging::Debug lsst::pex::logging::ScreenLog lsst::pex::logging::DualLog

Public Member Functions

 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 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 int DEBUG
 
static const int INFO
 
static const int WARN
 
static const int INHERIT_THRESHOLD
 
static const int FATAL
 

Protected Member Functions

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

static void setDefaultLog (Log *deflog)
 

Protected Attributes

boost::shared_ptr
< threshold::Memory
_thresholds
 
std::list< boost::shared_ptr
< LogDestination > > 
_destinations
 
lsst::daf::base::PropertySet::Ptr _preamble
 

Static Protected Attributes

static LogdefaultLog
 
static const std::string _sep
 

Private Member Functions

void completePreamble ()
 

Private Attributes

int _threshold
 
boost::shared_ptr< bool > _defShowAll
 
boost::shared_ptr< bool > _myShowAll
 
std::string _name
 

Detailed Description

a place to record messages and descriptions of the state of processing.

This class is the centerpiece of the logging framework. It allows modules to record plain text statements about what is happening (including errors, warnings, status information, and debugging messages) as well as typed data delivered as named properties. It allows users to conveniently tag their messages with a hierarchical label that can indicate where in the application the message originates. Messages sent to a Log can be routed to multiple destinations, such as to the terminal screen, to a file and to the Event system, all simultaneously. Messages are also tagged with an importance or "loudness" level, and Logs control their verbosity via importance thresholds. If a message's importance level is less than the Log's threshold, it will not be recorded. This allows applications and modules to selectively turn on and off, say, debugging messages of which there may be a great number. Thresholds are enforced in a way to minimize the impact of unrecorded messages on overall performance, so debugging messages can remain permanently compiled into the code. Finally, the different streams that receive log messages can have their own thresholds set as well; this allows one to, for example, send more messages to a file than to the screen.

Logs used by an application are organized into a hierarchy. Applications normally get the root Log via the static method Log::getDefaultLog(). This log by default is configured to print messages to the screen (although a production application will typically replace the default Log with one that sends messages elsewhere). Alternatively, an application can configure its own root Log via the Log constructors, or with the convenience subclasses, ScreenLog and DualLog (used to send messages to both the screen and a file). It is possible to have multiple, independently-configured Log hierarchies, but it is intended that one is sufficient for an entire application.

A root Log has an empty string name associated with it. A module will usually create a "child" or "descendent" Log object to send its messages to, giving it a period-delimited name and a importance threshold:

Log mylog(Log::getDefaultLog(), "myapp.mymod", Log::INFO);

or

scoped_ptr<Log> 
      mylog(getDefaultLog().createChildLog("myapp.mymod", Log::INFO));

The new log will have the name "myapp.mymod" and allows messages at least as "loud" as Log::INFO. The defined levels, FATAL, WARN, INFO, DEBUG (set to 20, 10, 0, -10, respectively) are conventional notions to encourage uniformity of levels across modules. The sub-names between the periods indicate the levels of the Logging hierarchy. Note that once a threshold is set for a log at a particular level, it is remembered even after that log is deleted; when anther log is created with that name, its previous threshold is preserved. If no threshold is provided, it will default to that of its parents log. Furthermore, setting the threshold for a parent automatically updates the threshold for all of its descendents that have not otherwise set the threshold. For example,

Log root = Log::getDefaultLog(); // the root log; name is an empty string Log applog(root, "myapp"); // myapp: a child log Log *modlog = applog.createChildLog("mymod", Log::WARN); // myapp.mymod: a quieter grandchild log delete modlog; modlog = applog.createChildLog("mymod") // still set to Log::WARN

root.setThreshold(log::DEBUG); // root and applog now set to Log::DEBUG modlog.resetThreshold(); // modlog now also set to Log::DEBUG

As you can see in the example, names are set relative to their parent. That is, when we use a log called "myapp" to create a child called "mymod", the full name is "myapp.mymod". This allows a Log to be made a member of a class and given a name without knowing the context in which the class is being used. Note that it is not necessary to create logs at intervening levels; the first example above, shows us directly creating a "grandchild" from the root Log.

Simple text log messages can be recorded with the log() functions:

mylog.log(Log::WARN, "Skipping initialization");
mylog.log(Log::WARN, boost::format("Found only %d objects") % nobj);

For more complex messages that might include named properties, it is usually more convenient to use the streaming method:

using lsst::pex::logging::Rec;
using lsst::pex::logging::Prop;
Rec(mylog, Log::DEBUG) << "Completed deconvolution"
                       << Prop("iterations", 541)
                       << Prop("rms", 0.0032)
                       << Rec::endr;   

Rec(mylog, Log::INFO) << boost::format("applying %s kernel") % kern
                      << Prop("width", width);
                      << Rec::endr;

The manipulator Rec::endr triggers the recording of the message to the log. Note that Rec is a shorthand typedef for the LogRec class.

Definition at line 154 of file Log.h.

Constructor & Destructor Documentation

lsst::pex::logging::Log::Log ( const int  threshold = INFO,
const std::string &  name = "" 
)

create a null log. This constructor should not normally be employed to obtain a Log; the static getDefaultLog() method should be used instead. This is provided primarily for subclasses and containers that require a no-arg constructor.

Parameters
thresholdthe initial importance threshold for this log
namethe initial name for this log. An empty string (the default) denotes a root log.
lsst::pex::logging::Log::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 
)

create a fully configured Log. This constructor is not normally employed to obtain a Log; the static getDefaultLog() method or the createChildLog() method of should be used instead.

Parameters
destinationsthe list of LogDestinations to attach to this Log.
preamblea data properties that should be included with every recorded message to the Log. This constructor will automatically add the properties "LOG", giving the Log name and "DATE", giving the timestamp the message was recorded.
namethe name to give this log. By default, the name will be an empty string, signifying a root log.
thresholdthe importance threshold to assign to this Log. Messages sent to this log must have a importance level equal to or greater than this value to be recorded. (Note that thresholds associated with destinations have their own thresholds that will override this one.)
defaultShowAllif true, log message properties will be shown by default when the messages are displayed. The default is false, indicating that their display must be turned on as needed.
lsst::pex::logging::Log::Log ( const Log parent,
const std::string &  childName,
int  threshold = INHERIT_THRESHOLD 
)

create a child of a given Log. The child log will be attached to the same streams as the provided parent Log. The full child name will be constructed from the given name, prepended by the parent's name and a ".". That is, if the parent is named "coo.coo" and the name given here is "ca-choo", then the full name will be "coo.coo.ca.choo". If the parent Log is a root Log, then the "." is not prepended.

Parameters
parentthe Log that will serve as its parent.
childNamethe name of the child log, relative to the given parent.
thresholdthe threshold for the new child Log. If not provided, the value will be set to the value it had the last time it was created, or if it is being created for the first time, it is set to track the threshold of the parent.
lsst::pex::logging::Log::Log ( const Log that)

create a copy

virtual lsst::pex::logging::Log::~Log ( )
virtual

delete this Log

Member Function Documentation

void lsst::pex::logging::Log::_format ( int  importance,
const char *  fmt,
va_list  ap 
)
protected

Format and call log(). Used by format(), debugf(), etc. Does not check the importance.

void lsst::pex::logging::Log::_send ( int  threshold,
int  importance,
const char *  fmt,
va_list  ap 
)
protected

format and send a message using a variable argument list. This does not check the Log threshold; it assumes this has already been done.

void lsst::pex::logging::Log::addDestination ( std::ostream &  destination,
int  threshold 
)

add a destination to this log. The destination stream will included in all child Logs created from this log after a call to this function. All previously created logs, including ancestor logs, will be unaffected. The IndentedFormatter format will be used with this new destination.

Parameters
destinationthe stream to send messages to
thresholdthe importance threshold to use to filter messages sent to the stream.
void lsst::pex::logging::Log::addDestination ( std::ostream &  destination,
int  threshold,
const boost::shared_ptr< LogFormatter > &  formatter 
)

add a destination to this log. The destination stream will included in all child Logs created from this log after a call to this function. All previously created logs, including ancestor logs, will be unaffected.

Parameters
destinationa pointer to the stream to send messages to. The caller is responsible for ensuring that the stream is neither closed nor its memory freed for the life of this Log.
thresholdthe importance threshold to use to filter messages sent to the stream.
formatterthe log formatter to use.
void lsst::pex::logging::Log::addDestination ( const boost::shared_ptr< LogDestination > &  destination)
inline

add a destination to this log. The destination stream will included in all child Logs created from this log after a call to this function. All previously created logs, including ancestor logs, will be unaffected.

Definition at line 573 of file Log.h.

573  {
574  _destinations.push_back(destination);
575  }
std::list< boost::shared_ptr< LogDestination > > _destinations
Definition: Log.h:684
template<class T >
void lsst::pex::logging::Log::addPreambleProperty ( const std::string &  name,
const T &  val 
)

add a property to the preamble

Definition at line 694 of file Log.h.

694  {
695  _preamble->add<T>(name, val);
696 }
table::Key< std::string > name
Definition: ApCorrMap.cc:71
lsst::daf::base::PropertySet::Ptr _preamble
Definition: Log.h:690
bool val
static void lsst::pex::logging::Log::closeDefaultLog ( )
static

shutdown and destroy the default log

void lsst::pex::logging::Log::completePreamble ( )
private
Log* lsst::pex::logging::Log::createChildLog ( const std::string &  childName,
int  threshold = INHERIT_THRESHOLD 
) const

create a child of a given Log. The child log will be attached to the same streams as the provided parent Log. The full child name will be constructed from the given name, prepended by the parent's name and a ".". That is, if the parent is named "coo.coo" and the name given here is "ca-choo", then the full name will be "coo.coo.ca.choo". If the parent Log is a root Log, then the "." is not prepended.

Parameters
childNamethe name of the child log, relative to the given parent.
thresholdthe threshold for the new child Log. If not provided, the value will be set to the value it had the last time it was created, or if it is being created for the first time, it is set to track the threshold of the parent.
static void lsst::pex::logging::Log::createDefaultLog ( const std::list< boost::shared_ptr< LogDestination > > &  destinations,
const lsst::daf::base::PropertySet preamble,
const std::string &  name = "",
const int  threshold = INFO 
)
static

create a new log and set it as the default Log

Parameters
destinationsthe list of LogDestinations to attach to this Log.
preamblea list of data properties that should be included with every recorded message to the Log. This constructor will automatically add the properties "LOG", giving the Log name and "DATE", giving the timestamp the message was recorded.
namethe name to give this log. By default, the name will be an empty string, signifying a root log.
thresholdthe importance threshold to assign to this Log. Messages sent to this log must have a importance level equal to or greater than this value to be recorded. (Note that thresholds associated with destinations have their own thresholds that will override this one.)
void lsst::pex::logging::Log::debugf ( const char *  fmt,
  ... 
)
inline

Definition at line 527 of file Log.h.

template<class T >
void lsst::pex::logging::Log::fatal ( const std::string &  message,
const std::string &  name,
const T &  val 
)
inline

Definition at line 495 of file Log.h.

519 { \
template<class T >
void lsst::pex::logging::Log::fatal ( const std::string &  message,
const RecordProperty< T > &  prop 
)
inline

Definition at line 495 of file Log.h.

519 { \
void lsst::pex::logging::Log::fatal ( const std::string &  message)
inline

Definition at line 495 of file Log.h.

519 { \
void lsst::pex::logging::Log::fatal ( const boost::format &  message)
inline

Definition at line 495 of file Log.h.

519 { \
void lsst::pex::logging::Log::fatal ( const std::string &  message,
const lsst::daf::base::PropertySet properties 
)
inline

Definition at line 495 of file Log.h.

519 { \
void lsst::pex::logging::Log::fatalf ( const char *  fmt,
  ... 
)
inline

Definition at line 530 of file Log.h.

void lsst::pex::logging::Log::format ( int  importance,
const char *  fmt,
  ... 
)

send a simple, formatted message. Use of this function tends to perform better than log(int, boost::format) as the formatting is only done if the message will actually get recorded.

Parameters
importancehow loud the message should be
fmta printf-style format string
...the inputs to the formatting.
static Log& lsst::pex::logging::Log::getDefaultLog ( )
static

obtain the default root Log instance.

const std::string& lsst::pex::logging::Log::getName ( ) const
inline

return the name associated with this Log. The root logger will return an empty stream as its name.

Definition at line 274 of file Log.h.

274 { return _name; }
std::string _name
Definition: Log.h:673
const lsst::daf::base::PropertySet& lsst::pex::logging::Log::getPreamble ( )
inline

return the current set of preamble properties

Definition at line 580 of file Log.h.

580 { return *_preamble; }
lsst::daf::base::PropertySet::Ptr _preamble
Definition: Log.h:690
int lsst::pex::logging::Log::getThreshold ( ) const
inline

return the importance threshold for this log. A message sent to this Log will not be recorded if the message importance is less than the threshold.

Definition at line 281 of file Log.h.

281  {
282  return ((_threshold > INHERIT_THRESHOLD || _name.length() == 0)
283  ? _threshold
284  : _thresholds->getThresholdFor(_name) );
285  }
static const int INHERIT_THRESHOLD
Definition: Log.h:183
std::string _name
Definition: Log.h:673
boost::shared_ptr< threshold::Memory > _thresholds
Definition: Log.h:679
int lsst::pex::logging::Log::getThresholdFor ( const std::string &  name) const

get the importance threshold for a child Log. When a child Log of the same name is created, this is the threshold it will have.

Parameters
namethe relative name of the child log
void lsst::pex::logging::Log::info ( const std::string &  message,
const lsst::daf::base::PropertySet properties 
)
inline

Definition at line 493 of file Log.h.

519 { \
template<class T >
void lsst::pex::logging::Log::info ( const std::string &  message,
const std::string &  name,
const T &  val 
)
inline

Definition at line 493 of file Log.h.

519 { \
template<class T >
void lsst::pex::logging::Log::info ( const std::string &  message,
const RecordProperty< T > &  prop 
)
inline

Definition at line 493 of file Log.h.

519 { \
void lsst::pex::logging::Log::info ( const std::string &  message)
inline

Definition at line 493 of file Log.h.

519 { \
void lsst::pex::logging::Log::info ( const boost::format &  message)
inline

Definition at line 493 of file Log.h.

519 { \
void lsst::pex::logging::Log::infof ( const char *  fmt,
  ... 
)
inline

Definition at line 528 of file Log.h.

void lsst::pex::logging::Log::log ( int  importance,
const std::string &  message,
const lsst::daf::base::PropertySet properties 
)

send a message to the log

Parameters
importancehow loud the message should be
messagea simple bit of text to send in the message
propertiesa list of properties to include in the message.
template<class T >
void lsst::pex::logging::Log::log ( int  importance,
const std::string &  message,
const std::string &  name,
const T &  val 
)

send a message to the log

Parameters
importancehow loud the message should be
messagea simple bit of text to send in the message
namethe name of a property to include in the message.
valthe value of the property to include

Definition at line 704 of file Log.h.

705  {
706 
707  int threshold = getThreshold();
708  if (importance < threshold)
709  return;
710  LogRecord rec(threshold, importance, *_preamble, willShowAll());
711  rec.addComment(message);
712  rec.addProperty(name, val);
713  send(rec);
714 }
table::Key< std::string > name
Definition: ApCorrMap.cc:71
int getThreshold() const
Definition: Log.h:281
void send(const LogRecord &record)
lsst::daf::base::PropertySet::Ptr _preamble
Definition: Log.h:690
bool val
bool willShowAll() const
Definition: Log.h:335
template<class T >
void lsst::pex::logging::Log::log ( int  importance,
const std::string &  message,
const RecordProperty< T > &  prop 
)

send a message to the log

Parameters
importancehow loud the message should be
messagea simple bit of text to send in the message
propa property to include in the message.

Definition at line 717 of file Log.h.

719 {
720  log(importance, message, prop.name, prop.value);
721 }
void log(int importance, const std::string &message, const lsst::daf::base::PropertySet &properties)
void lsst::pex::logging::Log::log ( int  importance,
const std::string &  message 
)

send a simple message to the log

Parameters
importancehow loud the message should be
messagea simple bit of text to send in the message
void lsst::pex::logging::Log::log ( int  importance,
const boost::format &  message 
)
inline

send a simple, formatted message to the log

Parameters
importancehow loud the message should be
messagea simple message in the form of a boost::format instance

Definition at line 450 of file Log.h.

450  {
451  log(importance, message.str());
452  }
void log(int importance, const std::string &message, const lsst::daf::base::PropertySet &properties)
void lsst::pex::logging::Log::logdebug ( const std::string &  message,
const lsst::daf::base::PropertySet properties 
)
inline

Definition at line 492 of file Log.h.

519 { \
template<class T >
void lsst::pex::logging::Log::logdebug ( const std::string &  message,
const std::string &  name,
const T &  val 
)
inline

Definition at line 492 of file Log.h.

519 { \
template<class T >
void lsst::pex::logging::Log::logdebug ( const std::string &  message,
const RecordProperty< T > &  prop 
)
inline

Definition at line 492 of file Log.h.

519 { \
void lsst::pex::logging::Log::logdebug ( const std::string &  message)
inline

Definition at line 492 of file Log.h.

519 { \
void lsst::pex::logging::Log::logdebug ( const boost::format &  message)
inline

Definition at line 492 of file Log.h.

519 { \
void lsst::pex::logging::Log::markPersistent ( )
inline

Mark this Log as persistent in the Citizen framework. This should be called when storing Log objects in the global scope or when they are otherwise long-lived. When this function is not called on a global instance, the Citizen framework may complain about a leaked PropertySet.

Definition at line 589 of file Log.h.

589 { _preamble->markPersistent(); }
lsst::daf::base::PropertySet::Ptr _preamble
Definition: Log.h:690
Log& lsst::pex::logging::Log::operator= ( const Log that)

copy another log to this one.

void lsst::pex::logging::Log::printThresholds ( std::ostream &  out)
inline

print the entire tree of thresholds

Definition at line 628 of file Log.h.

628  {
629  _thresholds->printThresholds(out);
630  }
boost::shared_ptr< threshold::Memory > _thresholds
Definition: Log.h:679
void lsst::pex::logging::Log::reset ( )
inline

reset all thresholds to the default set at the construction of the root log. In general, use of this function is not recommended as it will affect all other users of Logs.

Definition at line 637 of file Log.h.

637 { _thresholds->forgetAllNames(); }
boost::shared_ptr< threshold::Memory > _thresholds
Definition: Log.h:679
void lsst::pex::logging::Log::resetShowAll ( )
inline

reset whether to all properties are display to what ever the root log is set to do.

Definition at line 367 of file Log.h.

367  {
368  if (_defShowAll.get() == _myShowAll.get())
369  *_myShowAll = false;
370  else
371  _myShowAll.reset();
372  }
boost::shared_ptr< bool > _myShowAll
Definition: Log.h:672
boost::shared_ptr< bool > _defShowAll
Definition: Log.h:671
void lsst::pex::logging::Log::resetThreshold ( )
inline

reset the importance threshold of this log to that of its parent threshold. If this is a root Log, the threshold will be set to INFO.

Definition at line 308 of file Log.h.

static const int INHERIT_THRESHOLD
Definition: Log.h:183
void setThreshold(int threshold)
Definition: Log.h:293
void lsst::pex::logging::Log::send ( const LogRecord record)

send a fully formed LogRecord to the log destinations

bool lsst::pex::logging::Log::sends ( int  importance) const
inline

return true if the threshold is low enough to pass messages of a given loudness or importance.

Definition at line 302 of file Log.h.

302 { return (importance >= getThreshold()); }
int getThreshold() const
Definition: Log.h:281
static void lsst::pex::logging::Log::setDefaultLog ( Log deflog)
staticprotected

set the default Log. The pointer sent to this method should be a freshly minted pointer, "unowned" by anyone. That is, the caller relinguishes responsibility for deleting the log by calling this function.

template<class T >
void lsst::pex::logging::Log::setPreambleProperty ( const std::string &  name,
const T &  val 
)

set a property to the preamble, overwriting any value with the same name.

Definition at line 699 of file Log.h.

699  {
700  _preamble->set<T>(name, val);
701 }
table::Key< std::string > name
Definition: ApCorrMap.cc:71
lsst::daf::base::PropertySet::Ptr _preamble
Definition: Log.h:690
bool val
void lsst::pex::logging::Log::setShowAll ( bool  yesno)
inline

set whether all of the properties should be displayed when rendering log records. This preference will be passed to LogFormatters via all LogRecords created by or sent via this Log. A LogFormatter may or may not choose to honor the preference, according to the purposes of its implmentation.

Note that while this attribute's default value is inherited from the root log, it is not persistently associated with the log's name like the importance threshold. If this log is destroyed and then recreated again with the same name, this attribute will revert to that of the root log.

Parameters
yesnothe preference for showing all. willShowAll() will return this value.

Definition at line 356 of file Log.h.

356  {
357  if (_myShowAll.get())
358  *_myShowAll = yesno;
359  else
360  _myShowAll.reset(new bool(yesno));
361  }
boost::shared_ptr< bool > _myShowAll
Definition: Log.h:672
void lsst::pex::logging::Log::setThreshold ( int  threshold)
inline

set the importance threshold for this log. A message sent to this Log will not be recorded if the message importance is less than the threshold.

Parameters
thresholdthe new threshold value

Definition at line 293 of file Log.h.

293  {
294  _threshold = threshold;
295  _thresholds->setThresholdFor(_name, threshold);
296  }
std::string _name
Definition: Log.h:673
boost::shared_ptr< threshold::Memory > _thresholds
Definition: Log.h:679
void lsst::pex::logging::Log::setThresholdFor ( const std::string &  name,
int  threshold 
)

set the importance threshold for a child Log. When a child Log of the same name is created, it will be assigned this threshold. Any existing Log object with name that has already explicitly set its importance threshold will not be affected; however, those that are set to inherit the threshold will be.

Parameters
namethe relative name of the child log
thresholdthe importance threshold to set Logs with this name to.
template<class T >
void lsst::pex::logging::Log::warn ( const std::string &  message,
const RecordProperty< T > &  prop 
)
inline

Definition at line 494 of file Log.h.

519 { \
void lsst::pex::logging::Log::warn ( const std::string &  message,
const lsst::daf::base::PropertySet properties 
)
inline

Definition at line 494 of file Log.h.

519 { \
void lsst::pex::logging::Log::warn ( const std::string &  message)
inline

Definition at line 494 of file Log.h.

519 { \
template<class T >
void lsst::pex::logging::Log::warn ( const std::string &  message,
const std::string &  name,
const T &  val 
)
inline

Definition at line 494 of file Log.h.

519 { \
void lsst::pex::logging::Log::warn ( const boost::format &  message)
inline

Definition at line 494 of file Log.h.

519 { \
void lsst::pex::logging::Log::warnf ( const char *  fmt,
  ... 
)
inline

Definition at line 529 of file Log.h.

bool lsst::pex::logging::Log::willShowAll ( ) const
inline

return true if this log will prefer showing all properties when rendering log records. This preference will be passed to LogFormatters via all LogRecords created by or sent via this Log. A LogFormatter may or may not choose to honor this preference when the LogRecord is rendered.

Definition at line 335 of file Log.h.

335  {
336  return
337  (_myShowAll.get()) ? *_myShowAll
338  : ((_defShowAll.get()) ? *_defShowAll : false);
339  }
boost::shared_ptr< bool > _myShowAll
Definition: Log.h:672
boost::shared_ptr< bool > _defShowAll
Definition: Log.h:671

Member Data Documentation

boost::shared_ptr<bool> lsst::pex::logging::Log::_defShowAll
private

Definition at line 671 of file Log.h.

std::list<boost::shared_ptr<LogDestination> > lsst::pex::logging::Log::_destinations
protected

the list of destinations to send messages to

Definition at line 684 of file Log.h.

boost::shared_ptr<bool> lsst::pex::logging::Log::_myShowAll
private

Definition at line 672 of file Log.h.

std::string lsst::pex::logging::Log::_name
private

Definition at line 673 of file Log.h.

lsst::daf::base::PropertySet::Ptr lsst::pex::logging::Log::_preamble
protected

the list preamble data properties that are included with every log record.

Definition at line 690 of file Log.h.

const std::string lsst::pex::logging::Log::_sep
staticprotected

Definition at line 653 of file Log.h.

int lsst::pex::logging::Log::_threshold
private

Definition at line 670 of file Log.h.

boost::shared_ptr<threshold::Memory> lsst::pex::logging::Log::_thresholds
protected

the memory of child importance thresholds.

Definition at line 679 of file Log.h.

const int lsst::pex::logging::Log::DEBUG
static

the conventional importance level for messages that aid in debugging. This value is set to -10 with the intention that messages with negative importance levels (or more precisely, >= -10) will be printed when the threshold is set to this value.

Definition at line 163 of file Log.h.

Log* lsst::pex::logging::Log::defaultLog
staticprotected

the default Log

Definition at line 643 of file Log.h.

const int lsst::pex::logging::Log::FATAL
static

the conventional importance level for messages that report on fatal behavior. The value is set to 20. Note that the logging module makes no attempt to shutdown execution or other wise affect control flow when a message having a importance exceeding this level.

Definition at line 191 of file Log.h.

const int lsst::pex::logging::Log::INFO
static

the conventional importance level for messages that are informational and which report on normal behavior. The value is set to 0 with the intention that this is the default threshold for logs and their destinations.

Definition at line 171 of file Log.h.

const int lsst::pex::logging::Log::INHERIT_THRESHOLD
static

a magic threshold value that indicates that a threshold of a Log should be set to its nearest ancestor

Definition at line 183 of file Log.h.

const int lsst::pex::logging::Log::WARN
static

the conventional importance level for messages that warn about abnormal but non-fatal behavior. The value is set to 10.

Definition at line 177 of file Log.h.


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