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 | List of all members
lsst::pex::logging::Debug Class Reference

#include <Debug.h>

Inheritance diagram for lsst::pex::logging::Debug:
lsst::pex::logging::Log

Public Member Functions

 Debug (const std::string &name, int verbosity=-1 *Log::INHERIT_THRESHOLD)
 
 Debug (const Log &parent, const std::string &name, int verbosity=-1 *Log::INHERIT_THRESHOLD)
 
 Debug (const Debug &that)
 
Debugoperator= (const Debug &that)
 
void debug (int verbosity, const std::string &message)
 
void debug (int verbosity, const boost::format &message)
 
void debug (int verbosity, const char *fmt,...)
 
void debug (int verbosity, const char *fmt, va_list ap)
 
template<int VERBOSITY>
void debug (const std::string &message)
 
template<int VERBOSITY>
void debug (const char *fmt,...)
 
- 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 ()
 

Additional Inherited Members

- 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 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
 
- 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 special logger used for recording debugging messages.

This class provides some added efficiencies for logging debug messages. In particular, message filtering can be done at compile time, by setting a maximum verboseness level with the LSST_MAX_DEBUG preprocessor define. Note that this define must be set before including Debug.h.

Debug messages are sent through the debug() member functions. Note that verbosity filtering is different than with the Log API. With Log, messages are sent with "importance" levels. However, with the Debug functions, messages are tagged with a "verbosity" level–that is, the higher the verbosity, the less likely the message will be recorded. In fact verbosity is the inverse of–i.e. the negative of–importance. The importance threshold of a Debug Log is -1*LSST_MAX_DEBUG.

Definition at line 75 of file Debug.h.

Constructor & Destructor Documentation

lsst::pex::logging::Debug::Debug ( const std::string &  name,
int  verbosity = -1*Log::INHERIT_THRESHOLD 
)
inline

Definition at line 78 of file Debug.h.

79  : Log(Log::getDefaultLog(), name, -1*verbosity) { }
table::Key< std::string > name
Definition: ApCorrMap.cc:71
static Log & getDefaultLog()
Log(const int threshold=INFO, const std::string &name="")
lsst::pex::logging::Debug::Debug ( const Log parent,
const std::string &  name,
int  verbosity = -1*Log::INHERIT_THRESHOLD 
)
inline

Definition at line 81 of file Debug.h.

83  : Log(parent, name , -1*verbosity) { }
table::Key< std::string > name
Definition: ApCorrMap.cc:71
Log(const int threshold=INFO, const std::string &name="")
lsst::pex::logging::Debug::Debug ( const Debug that)
inline

Definition at line 84 of file Debug.h.

84 : Log(that) { }
Log(const int threshold=INFO, const std::string &name="")

Member Function Documentation

void lsst::pex::logging::Debug::debug ( int  verbosity,
const std::string &  message 
)
inline

print a debug message with a particular verbosity. The decision whether to print this message is done at runtime (just like a normal log message); thus, a message sent to this function that ultimately will not be printed carries more overhead than one sent to debug<n>(). While debug<n>() is thus normally preferred, this function can be useful for temporarily overriding the compile-time verbosity limit.

Parameters
verbositythe verbosity level of this message. It will be printed if the value is equal to or lower than the verbosity limit set when the object was constructed.
messagethe message to print.

Definition at line 104 of file Debug.h.

104  {
105  log(-1*verbosity, message);
106  }
void log(int importance, const std::string &message, const lsst::daf::base::PropertySet &properties)
void lsst::pex::logging::Debug::debug ( int  verbosity,
const boost::format &  message 
)
inline

print a debug message with a particular verbosity. The decision whether to print this message is done at runtime (just like a normal log message); thus, a message sent to this function that ultimately will not be printed carries more overhead than one sent to debug<n>(). Use of this method typically carries the extra overhead of formatting the message. While debug<n>() is thus normally preferred, this function can be useful for temporarily overriding the compile-time verbosity limit.

Definition at line 118 of file Debug.h.

118  {
119  log(-1*verbosity, message);
120  }
void log(int importance, const std::string &message, const lsst::daf::base::PropertySet &properties)
void lsst::pex::logging::Debug::debug ( int  verbosity,
const char *  fmt,
  ... 
)
inline

print a formatted message with a particular verbosity.

Parameters
verbositythe verboseness to associate with this message
fmta printf-style format string
...the inputs to the formatting.

Definition at line 128 of file Debug.h.

128  {
129  va_list ap;
130  va_start(ap, fmt);
131  debug(verbosity, fmt, ap);
132  va_end(ap);
133  }
void debug(int verbosity, const std::string &message)
Definition: Debug.h:104
void lsst::pex::logging::Debug::debug ( int  verbosity,
const char *  fmt,
va_list  ap 
)
inline

print a formatted message with a particular verbosity. This function is not usually called directly by applications.

Parameters
verbositythe verboseness to associate with this message
fmta printf-style format string
apthe inputs to the formatting.

Definition at line 142 of file Debug.h.

142  {
143  if (-1 * verbosity < getThreshold()) return;
144  _format(-1*verbosity, fmt, ap);
145  }
int getThreshold() const
Definition: Log.h:281
void _format(int importance, const char *fmt, va_list ap)
template<int VERBOSITY>
void lsst::pex::logging::Debug::debug ( const std::string &  message)
inline

conditionally print the given debug message if VERBOSITY is less than or equal to LSST_MAX_DEBUG. This condition is evaluated at compile-time; thus, it is more efficient than the debug() functions.

Definition at line 153 of file Debug.h.

153  {
154  if (LSST_MAX_DEBUG <= 0 || VERBOSITY <= LSST_MAX_DEBUG) {
155  log(-1*VERBOSITY, message);
156  }
157  }
void log(int importance, const std::string &message, const lsst::daf::base::PropertySet &properties)
#define LSST_MAX_DEBUG
Definition: Debug.h:56
template<int VERBOSITY>
void lsst::pex::logging::Debug::debug ( const char *  fmt,
  ... 
)
inline

conditionally print a debug message via a format string if VERBOSITY is less than or equal to LSST_MAX_DEBUG. This condition is evaluated at compile-time; thus, it is more efficient than the debug() functions.

Parameters
fmtthe C-style (as in printf) format string.
...the values to plug into the string. Any number may be provided, though they must match the format string.

Definition at line 168 of file Debug.h.

168  {
169  if (LSST_MAX_DEBUG <= 0 || VERBOSITY <= LSST_MAX_DEBUG) {
170  va_list ap;
171  va_start(ap, fmt);
172  debug(VERBOSITY, fmt, ap);
173  va_end(ap);
174  }
175  }
#define LSST_MAX_DEBUG
Definition: Debug.h:56
void debug(int verbosity, const std::string &message)
Definition: Debug.h:104
Debug& lsst::pex::logging::Debug::operator= ( const Debug that)
inline

Definition at line 86 of file Debug.h.

86  {
87  if (this != &that) dynamic_cast<Log*>(this)->operator=(that);
88  return *this;
89  }
Log(const int threshold=INFO, const std::string &name="")

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