30 #ifndef LSST_PEX_LOG_H
31 #define LSST_PEX_LOG_H
41 #include <boost/shared_ptr.hpp>
45 # define __attribute__(x)
51 #define ATTRIB_FORMAT(fmt,start) __attribute__ ((format(printf,fmt,start)))
202 Log(
const int threshold=
INFO,
const std::string&
name=
"");
229 Log(
const std::list<boost::shared_ptr<LogDestination> >& destinations,
231 const std::string&
name=
"",
const int threshold=
INFO,
232 bool defaultShowAll=
false);
252 Log(
const Log& parent,
const std::string& childName,
413 void log(
int importance,
const std::string& message,
424 void log(
int importance,
const std::string& message,
425 const std::string&
name,
const T&
val);
434 void log(
int importance,
const std::string& message,
442 void log(
int importance,
const std::string& message);
451 log(importance, message.str());
471 #define LEVELF(fname, lev) \
472 void fname(const std::string& message, \
473 const lsst::daf::base::PropertySet& properties) { \
474 log(lev, message, properties); \
477 void fname(const std::string& message, \
478 const std::string& name, const T& val) { \
479 log<T>(lev, message, name, val); \
482 void fname(const std::string& message, \
483 const RecordProperty<T>& prop) { \
484 log<T>(lev, message, prop); \
486 void fname(const std::string& message) { \
489 void fname(const boost::format& message) { \
506 void format(
int importance,
const char *fmt, ...)
517 #define LEVELF(fname, lev) \
518 void fname(const char* fmt, ...) \
519 ATTRIB_FORMAT(2, 3) { \
520 if (lev < getThreshold()) return; \
523 _format(lev, fmt, ap); \
565 const boost::shared_ptr<LogFormatter> &formatter);
616 const std::list<boost::shared_ptr<LogDestination> >& destinations,
618 const std::string&
name=
"",
const int threshold=
INFO);
659 void _send(
int threshold,
int importance,
const char *fmt, va_list ap);
665 void _format(
int importance,
const char* fmt, va_list ap);
704 void Log::log(
int importance,
const std::string& message,
705 const std::string&
name,
const T&
val) {
708 if (importance < threshold)
717 void Log::log(
int importance,
const std::string& message,
740 :
LogRecord(log.getThreshold(), importance, log.getPreamble()),
797 LogRec& operator<<(const RecordProperty<T>& prop) {
844 #endif // end LSST_PEX_LOG_H
LogRec(const LogRec &that)
LogRec & operator<<(const std::string &comment)
static void setDefaultLog(Log *deflog)
table::Key< std::string > name
int getThresholdFor(const std::string &name) const
LogRec & operator<<(const boost::format &comment)
void addComment(const std::string &comment)
void _format(int importance, const char *fmt, va_list ap)
boost::shared_ptr< PropertySet > Ptr
#define LEVELF(fname, lev)
void format(int importance, const char *fmt,...)
void fatalf(const char *fmt,...)
void infof(const char *fmt,...)
void setShowAll(bool yesno)
static const std::string _sep
Log & operator=(const Log &that)
void log(int importance, const std::string &message, const lsst::daf::base::PropertySet &properties)
void send(const LogRecord &record)
lsst::daf::base::PropertySet::Ptr _preamble
a place to record messages and descriptions of the state of processing.
static Log & getDefaultLog()
A LogRecord attached to a particular Log that suppports stream stream semantics.
void setPreambleProperty(const std::string &name, const T &val)
boost::shared_ptr< bool > _myShowAll
static void closeDefaultLog()
a container for constructing a single Log record
definition of the LogRecord, RecordProperty and Prop classes
static const int INHERIT_THRESHOLD
void logdebug(const std::string &message, const lsst::daf::base::PropertySet &properties)
void _send(int threshold, int importance, const char *fmt, va_list ap)
void printThresholds(std::ostream &out)
const std::string & getName() const
void addDestination(std::ostream &destination, int threshold)
definition of the LogDestination class
LogRec(Log &log, int importance)
void addProperty(const RecordProperty< T > &property)
void debugf(const char *fmt,...)
LogRec & operator<<(const lsst::daf::base::PropertySet &props)
void fatal(const std::string &message, const lsst::daf::base::PropertySet &properties)
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)
bool sends(int importance) const
LogRec & operator<<(Manip signal)
Log * createChildLog(const std::string &childName, int threshold=INHERIT_THRESHOLD) const
definition of the Memory class
void log(int importance, const boost::format &message)
void setThresholdFor(const std::string &name, int threshold)
boost::shared_ptr< bool > _defShowAll
Class for storing generic metadata.
void warn(const std::string &message, const lsst::daf::base::PropertySet &properties)
std::list< boost::shared_ptr< LogDestination > > _destinations
const lsst::daf::base::PropertySet & getPreamble()
Interface for PropertySet class.
void warnf(const char *fmt,...)
#define ATTRIB_FORMAT(fmt, start)
a container for a named data property for a LogRecord
void addProperties(const lsst::daf::base::PropertySet &props)
void addPreambleProperty(const std::string &name, const T &val)
Log(const int threshold=INFO, const std::string &name="")
LogRec & operator=(const LogRec &that)
boost::shared_ptr< threshold::Memory > _thresholds
void info(const std::string &message, const lsst::daf::base::PropertySet &properties)
void setThreshold(int threshold)
LogRecord & operator=(const LogRecord &that)
void addDestination(const boost::shared_ptr< LogDestination > &destination)