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
Classes | Namespaces | Macros
Log.h File Reference
#include <stack>
#include <stdarg.h>
#include <string>
#include <vector>
#include <log4cxx/logger.h>
#include <boost/format.hpp>

Go to the source code of this file.

Classes

class  lsst.log::detail::LogFormatter
 
class  lsst.log::Log
 
class  lsst.log::LogContext
 

Namespaces

 lsst
 Estimate image backgrounds.
 
 lsst.log
 
 lsst::log::detail
 

Macros

#define LOG_CONFIG(filename)   lsst::log::Log::configure(filename)
 
#define LOG_CONFIG_PROP(string)   lsst::log::Log::configure_prop(string)
 
#define LOG_DEFAULT_NAME()   lsst::log::Log::getDefaultLoggerName()
 
#define LOG_GET(logger)   lsst::log::Log::getLogger(logger)
 
#define LOG_PUSHCTX(name)   lsst::log::Log::pushContext(name)
 
#define LOG_POPCTX()   lsst::log::Log::popContext()
 
#define LOG_MDC(key, value)   lsst::log::Log::MDC(key, value)
 
#define LOG_MDC_REMOVE(key)   lsst::log::Log::MDCRemove(key)
 
#define LOG_SET_LVL(logger, level)   lsst::log::Log::setLevel(logger, level)
 
#define LOG_GET_LVL(logger)   lsst::log::Log::getLevel(logger)
 
#define LOG_CHECK_LVL(logger, level)   lsst::log::Log::isEnabledFor(logger, level)
 
#define LOG_CHECK_TRACE()   LOG4CXX_UNLIKELY(lsst::log::Log::defaultLogger->isTraceEnabled())
 
#define LOG_CHECK_DEBUG()   LOG4CXX_UNLIKELY(lsst::log::Log::defaultLogger->isDebugEnabled())
 
#define LOG_CHECK_INFO()   lsst::log::Log::defaultLogger->isInfoEnabled()
 
#define LOG_CHECK_WARN()   lsst::log::Log::defaultLogger->isWarnEnabled()
 
#define LOG_CHECK_ERROR()   lsst::log::Log::defaultLogger->isErrorEnabled()
 
#define LOG_CHECK_FATAL()   lsst::log::Log::defaultLogger->isFatalEnabled()
 
#define LOGF(logger, level, message)
 
#define LOGF_TRACE(message)
 
#define LOGF_DEBUG(message)
 
#define LOGF_INFO(message)
 
#define LOGF_WARN(message)
 
#define LOGF_ERROR(message)
 
#define LOGF_FATAL(message)
 
#define LOG(logger, level, message...)
 
#define LOG_TRACE(message...)
 
#define LOG_DEBUG(message...)
 
#define LOG_INFO(message...)
 
#define LOG_WARN(message...)
 
#define LOG_ERROR(message...)
 
#define LOG_FATAL(message...)
 
#define LOG_LVL_TRACE   static_cast<int>(log4cxx::Level::TRACE_INT)
 
#define LOG_LVL_DEBUG   static_cast<int>(log4cxx::Level::DEBUG_INT)
 
#define LOG_LVL_INFO   static_cast<int>(log4cxx::Level::INFO_INT)
 
#define LOG_LVL_WARN   static_cast<int>(log4cxx::Level::WARN_INT)
 
#define LOG_LVL_ERROR   static_cast<int>(log4cxx::Level::ERROR_INT)
 
#define LOG_LVL_FATAL   static_cast<int>(log4cxx::Level::FATAL_INT)
 
#define LOG_LOGGER   log4cxx::LoggerPtr
 
#define LOG_CTX   lsst::log::LogContext
 

Macro Definition Documentation

#define LOG (   logger,
  level,
  message... 
)
Value:
do { if (lsst::log::Log::isEnabledFor(logger, level)) { \
lsst::log::Log::log(logger, log4cxx::Level::toLevel(level), \
__BASE_FILE__, __PRETTY_FUNCTION__, __LINE__, message); } \
} while (false)
static bool isEnabledFor(log4cxx::LoggerPtr logger, int level)
Definition: Log.cc:326
static void log(std::string const &loggername, log4cxx::LevelPtr level, std::string const &filename, std::string const &funcname, unsigned int lineno, char const *fmt,...)
Definition: Log.cc:360

Log a message using a varargs/printf style interface.

Parameters
loggerEither name of logger or log4cxx logger object.
levelLogging level associated with message.
messageAn sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

Definition at line 339 of file Log.h.

#define LOG_CHECK_DEBUG ( )    LOG4CXX_UNLIKELY(lsst::log::Log::defaultLogger->isDebugEnabled())

Return whether the logging threshold of the default logger is less than or equal to DEBUG.

Returns
Bool indicating whether or not logger is enabled.

Definition at line 178 of file Log.h.

#define LOG_CHECK_ERROR ( )    lsst::log::Log::defaultLogger->isErrorEnabled()

Return whether the logging threshold of the default logger is less than or equal to ERROR.

Returns
Bool indicating whether or not logger is enabled.

Definition at line 205 of file Log.h.

#define LOG_CHECK_FATAL ( )    lsst::log::Log::defaultLogger->isFatalEnabled()

Return whether the logging threshold of the default logger is less than or equal to FATAL.

Returns
Bool indicating whether or not logger is enabled.

Definition at line 214 of file Log.h.

#define LOG_CHECK_INFO ( )    lsst::log::Log::defaultLogger->isInfoEnabled()

Return whether the logging threshold of the default logger is less than or equal to INFO.

Returns
Bool indicating whether or not logger is enabled.

Definition at line 187 of file Log.h.

#define LOG_CHECK_LVL (   logger,
  level 
)    lsst::log::Log::isEnabledFor(logger, level)

Return whether the logging threshold of LOGGER is less than or equal to LEVEL.

Returns
Bool indicating whether or not logger is enabled.
Parameters
loggerEither name of logger or log4cxx logger being queried.
levelLogging threshold to check.

Definition at line 160 of file Log.h.

#define LOG_CHECK_TRACE ( )    LOG4CXX_UNLIKELY(lsst::log::Log::defaultLogger->isTraceEnabled())

Return whether the logging threshold of the default logger is less than or equal to TRACE.

Returns
Bool indicating whether or not logger is enabled.

Definition at line 169 of file Log.h.

#define LOG_CHECK_WARN ( )    lsst::log::Log::defaultLogger->isWarnEnabled()

Return whether the logging threshold of the default logger is less than or equal to WARN.

Returns
Bool indicating whether or not logger is enabled.

Definition at line 196 of file Log.h.

#define LOG_CONFIG (   filename)    lsst::log::Log::configure(filename)

Configures log4cxx and initializes logging module.

Parameters
filenamePath to configuration file.

Definition at line 52 of file Log.h.

#define LOG_CONFIG_PROP (   string)    lsst::log::Log::configure_prop(string)

Configures log4cxx from a string containing list of properties. This is equivalent to configuring with a file name containing the same data as a string.

Note
Use of this macro will likely produce hard-coded configuration which is not advised for general-use code. It may be useful where pre-defined hard-coded configuration is necessary, e.g. in unit tests.
Parameters
stringList of properties (lines separated by new line character)

Definition at line 66 of file Log.h.

#define LOG_CTX   lsst::log::LogContext

Definition at line 443 of file Log.h.

#define LOG_DEBUG (   message...)
Value:
do { if (LOG4CXX_UNLIKELY(lsst::log::Log::defaultLogger->isDebugEnabled())) { \
log4cxx::Level::getDebug(), __BASE_FILE__, __PRETTY_FUNCTION__, \
__LINE__, message); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
Definition: Log.h:491
static void log(std::string const &loggername, log4cxx::LevelPtr level, std::string const &filename, std::string const &funcname, unsigned int lineno, char const *fmt,...)
Definition: Log.cc:360

Log a debug-level message to the default logger using a varargs/printf style interface.

Parameters
messageAn sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

Definition at line 368 of file Log.h.

#define LOG_DEFAULT_NAME ( )    lsst::log::Log::getDefaultLoggerName()

Get the current default logger name. Returns empty string for root logger.

Returns
String containing the default logger name.

Definition at line 73 of file Log.h.

#define LOG_ERROR (   message...)
Value:
do { if (lsst::log::Log::defaultLogger->isErrorEnabled()) { \
log4cxx::Level::getError(), __BASE_FILE__, __PRETTY_FUNCTION__, \
__LINE__, message); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
Definition: Log.h:491
static void log(std::string const &loggername, log4cxx::LevelPtr level, std::string const &filename, std::string const &funcname, unsigned int lineno, char const *fmt,...)
Definition: Log.cc:360

Log a error-level message to the default logger using a varargs/printf style interface.

Parameters
messageAn sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

Definition at line 413 of file Log.h.

#define LOG_FATAL (   message...)
Value:
do { if (lsst::log::Log::defaultLogger->isFatalEnabled()) { \
log4cxx::Level::getFatal(), __BASE_FILE__, __PRETTY_FUNCTION__, \
__LINE__, message); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
Definition: Log.h:491
static void log(std::string const &loggername, log4cxx::LevelPtr level, std::string const &filename, std::string const &funcname, unsigned int lineno, char const *fmt,...)
Definition: Log.cc:360

Log a fatal-level message to the default logger using a varargs/printf style interface.

Parameters
messageAn sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

Definition at line 428 of file Log.h.

#define LOG_GET (   logger)    lsst::log::Log::getLogger(logger)

Returns a pointer to the log4cxx logger object associated with logger.

Returns
log4cxx::LoggerPtr corresponding to logger.
Parameters
loggerEither a logger name or a log4cxx logger object.

Definition at line 82 of file Log.h.

#define LOG_GET_LVL (   logger)    lsst::log::Log::getLevel(logger)

Retrieve the logging threshold for LOGGER.

Returns
int Indicating the logging threshold.
Parameters
loggerEither name of logger or log4cxx logger with threshold to return.

Definition at line 148 of file Log.h.

#define LOG_INFO (   message...)
Value:
do { if (lsst::log::Log::defaultLogger->isInfoEnabled()) { \
log4cxx::Level::getInfo(), __BASE_FILE__, __PRETTY_FUNCTION__, \
__LINE__, message); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
Definition: Log.h:491
static void log(std::string const &loggername, log4cxx::LevelPtr level, std::string const &filename, std::string const &funcname, unsigned int lineno, char const *fmt,...)
Definition: Log.cc:360

Log a info-level message to the default logger using a varargs/printf style interface.

Parameters
messageAn sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

Definition at line 383 of file Log.h.

#define LOG_LOGGER   log4cxx::LoggerPtr

Definition at line 442 of file Log.h.

#define LOG_LVL_DEBUG   static_cast<int>(log4cxx::Level::DEBUG_INT)

Definition at line 436 of file Log.h.

#define LOG_LVL_ERROR   static_cast<int>(log4cxx::Level::ERROR_INT)

Definition at line 439 of file Log.h.

#define LOG_LVL_FATAL   static_cast<int>(log4cxx::Level::FATAL_INT)

Definition at line 440 of file Log.h.

#define LOG_LVL_INFO   static_cast<int>(log4cxx::Level::INFO_INT)

Definition at line 437 of file Log.h.

#define LOG_LVL_TRACE   static_cast<int>(log4cxx::Level::TRACE_INT)

Definition at line 435 of file Log.h.

#define LOG_LVL_WARN   static_cast<int>(log4cxx::Level::WARN_INT)

Definition at line 438 of file Log.h.

#define LOG_MDC (   key,
  value 
)    lsst::log::Log::MDC(key, value)

Places a KEY/VALUE pair in the Mapped Diagnostic Context (MDC) for the current thread. The VALUE may then be included in log messages by using the following the X conversion character within a pattern layout as X{KEY}.

Parameters
keyUnique key.
valueString value.

Definition at line 120 of file Log.h.

#define LOG_MDC_REMOVE (   key)    lsst::log::Log::MDCRemove(key)

Remove the value associated with KEY within the MDC.

Parameters
keyKey identifying value to remove.

Definition at line 128 of file Log.h.

#define LOG_POPCTX ( )    lsst::log::Log::popContext()

Pops the last pushed name off the global hierarchical default logger name.

Note
Call to this macro is not thread-safe.

Definition at line 108 of file Log.h.

#define LOG_PUSHCTX (   name)    lsst::log::Log::pushContext(name)

Pushes name onto the global hierarchical default logger name. Note that we only allow simple non-dotted names to be used for context names, multi-level context name (e.g. "componen1.component2") will result in exception. Empty context names are disallowed as well, exception will be raised for empty name.

Note
Call to this macro is not thread-safe, moreover context is global and applies to all threads (which means you want to avoid using this in multi-threaded applications).
Parameters
nameString to push onto logging context.
Exceptions
std::invalid_argumentraised for empty name or when name contains dot.

Definition at line 99 of file Log.h.

#define LOG_SET_LVL (   logger,
  level 
)    lsst::log::Log::setLevel(logger, level)

Set the logging threshold for LOGGER to LEVEL.

Parameters
loggerLogger with threshold to adjust.
levelNew logging threshold.

Definition at line 137 of file Log.h.

#define LOG_TRACE (   message...)
Value:
do { if (LOG4CXX_UNLIKELY(lsst::log::Log::defaultLogger->isTraceEnabled())) { \
log4cxx::Level::getTrace(), __BASE_FILE__, __PRETTY_FUNCTION__, \
__LINE__, message); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
Definition: Log.h:491
static void log(std::string const &loggername, log4cxx::LevelPtr level, std::string const &filename, std::string const &funcname, unsigned int lineno, char const *fmt,...)
Definition: Log.cc:360

Log a trace-level message to the default logger using a varargs/printf style interface.

Parameters
messageAn sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

Definition at line 353 of file Log.h.

#define LOG_WARN (   message...)
Value:
do { if (lsst::log::Log::defaultLogger->isWarnEnabled()) { \
log4cxx::Level::getWarn(), __BASE_FILE__, __PRETTY_FUNCTION__, \
__LINE__, message); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
Definition: Log.h:491
static void log(std::string const &loggername, log4cxx::LevelPtr level, std::string const &filename, std::string const &funcname, unsigned int lineno, char const *fmt,...)
Definition: Log.cc:360

Log a warn-level message to the default logger using a varargs/printf style interface.

Parameters
messageAn sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

Definition at line 398 of file Log.h.

#define LOGF (   logger,
  level,
  message 
)
Value:
do { if (lsst::log::Log::isEnabledFor(logger, level)) { \
lsst::log::detail::LogFormatter fmter_; \
lsst::log::Log::getLogger(logger)->forcedLog( \
log4cxx::Level::toLevel(level), (fmter_ % message).str(), \
LOG4CXX_LOCATION); } \
} while (false)
static log4cxx::LoggerPtr getLogger(log4cxx::LoggerPtr logger)
Definition: Log.cc:199
static bool isEnabledFor(log4cxx::LoggerPtr logger, int level)
Definition: Log.cc:326

Log a message using a boost::format style interface.

Parameters
loggerEither name of logger or log4cxx logger object.
levelLogging level associated with message.
messageA boost::format compatible format string followed by zero, one, or more arguments separated by %.

Definition at line 226 of file Log.h.

#define LOGF_DEBUG (   message)
Value:
do { if (LOG4CXX_UNLIKELY(lsst::log::Log::defaultLogger->isDebugEnabled())) { \
lsst::log::detail::LogFormatter fmter_; \
log4cxx::Level::getDebug(), (fmter_ % message).str(), \
LOG4CXX_LOCATION); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
Definition: Log.h:491

Log a debug-level message to the default logger using a boost::format style interface.

Parameters
messageA boost::format compatible format string followed by zero, one, or more arguments separated by %.

Definition at line 258 of file Log.h.

#define LOGF_ERROR (   message)
Value:
do { if (lsst::log::Log::defaultLogger->isErrorEnabled()) { \
lsst::log::detail::LogFormatter fmter_; \
log4cxx::Level::getError(), (fmter_ % message).str(), \
LOG4CXX_LOCATION); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
Definition: Log.h:491

Log a error-level message to the default logger using a boost::format style interface.

Parameters
messageA boost::format compatible format string followed by zero, one, or more arguments separated by %.

Definition at line 306 of file Log.h.

#define LOGF_FATAL (   message)
Value:
do { if (lsst::log::Log::defaultLogger->isFatalEnabled()) { \
lsst::log::detail::LogFormatter fmter_; \
log4cxx::Level::getFatal(), (fmter_ % message).str(), \
LOG4CXX_LOCATION); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
Definition: Log.h:491

Log a fatal-level message to the default logger using a boost::format style interface.

Parameters
messageA boost::format compatible format string followed by zero, one, or more arguments separated by %.

Definition at line 322 of file Log.h.

#define LOGF_INFO (   message)
Value:
do { if (lsst::log::Log::defaultLogger->isInfoEnabled()) { \
lsst::log::detail::LogFormatter fmter_; \
log4cxx::Level::getInfo(), (fmter_ % message).str(), \
LOG4CXX_LOCATION); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
Definition: Log.h:491

Log a info-level message to the default logger using a boost::format style interface.

Parameters
messageA boost::format compatible format string followed by zero, one, or more arguments separated by %.

Definition at line 274 of file Log.h.

#define LOGF_TRACE (   message)
Value:
do { if (LOG4CXX_UNLIKELY(lsst::log::Log::defaultLogger->isTraceEnabled())) { \
lsst::log::detail::LogFormatter fmter_; \
log4cxx::Level::getTrace(), (fmter_ % message).str(), \
LOG4CXX_LOCATION); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
Definition: Log.h:491

Log a trace-level message to the default logger using a boost::format style interface.

Parameters
messageA boost::format compatible format string followed by zero, one, or more arguments separated by %.

Definition at line 242 of file Log.h.

#define LOGF_WARN (   message)
Value:
do { if (lsst::log::Log::defaultLogger->isWarnEnabled()) { \
lsst::log::detail::LogFormatter fmter_; \
log4cxx::Level::getWarn(), (fmter_ % message).str(), \
LOG4CXX_LOCATION); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
Definition: Log.h:491

Log a warn-level message to the default logger using a boost::format style interface.

Parameters
messageA boost::format compatible format string followed by zero, one, or more arguments separated by %.

Definition at line 290 of file Log.h.