lsst.log g8479130295+e61a708df9
|
#include <Log.h>
Public Member Functions | |
bool | isDebugEnabled () const |
bool | isErrorEnabled () const |
bool | isFatalEnabled () const |
bool | isInfoEnabled () const |
bool | isTraceEnabled () const |
bool | isWarnEnabled () const |
std::string | getName () const |
void | setLevel (int level) |
int | getLevel () const |
int | getEffectiveLevel () const |
bool | isEnabledFor (int level) const |
Log | getChild (std::string const &suffix) const |
void | log (log4cxx::LevelPtr level, log4cxx::spi::LocationInfo const &location, char const *fmt,...) |
void | logMsg (log4cxx::LevelPtr level, log4cxx::spi::LocationInfo const &location, std::string const &msg) |
Static Public Member Functions | |
static Log | getDefaultLogger () |
Return default logger instance, same as default constructor. | |
static void | configure () |
static void | configure (std::string const &filename) |
static void | configure_prop (std::string const &properties) |
static Log | getLogger (Log const &logger) |
static Log | getLogger (std::string const &loggername) |
static std::string | MDC (std::string const &key, std::string const &value) |
static void | MDCRemove (std::string const &key) |
static int | MDCRegisterInit (std::function< void()> function) |
This static class includes a variety of methods for interacting with the the logging module. These methods are not meant for direct use. Rather, they are used by the LOG* macros and the SWIG interface declared in logInterface.h.
|
static |
Explicitly configures log4cxx and initializes logging system.
Configuration can be specified via environment variable LSST_LOG_CONFIG, if it is set and specifies existing file name then this file name is used for configuration. Otherwise pre-defined configuration is used, which is hardwired to add to the root logger a ConsoleAppender. In this case, the output will be formatted using a PatternLayout set to the pattern "%c %p: %m%n".
|
static |
Configures log4cxx from specified file.
If file name ends with ".xml", it is passed to log4cxx::xml::DOMConfigurator::configure(). Otherwise, it assumed to be a log4j Java properties file and is passed to log4cxx::PropertyConfigurator::configure(). See http://logging.apache.org/log4cxx/usage.html for additional details.
filename | Path to configuration file. |
|
static |
Configures log4cxx using a string containing the list of properties, equivalent to configuring from a file containing the same content but without creating temporary files.
properties | Configuration properties. |
Log lsst::log::Log::getChild | ( | std::string const & | suffix | ) | const |
Return a logger which is a descendant to this logger.
If for example name of this logger is "main.task" and suffix is "subtask1.algorithm" then this method will return logger with the name "main.task.subtask1.algorithm". If this logger is root logger then suffix name is used for returned logger name. If suffix is empty then this instance is returned.
suffix | Suffix for tha name of returned logger, can include dot (but not at leading position) and can be empty. |
int lsst::log::Log::getEffectiveLevel | ( | ) | const |
Retrieve the effective logging threshold.
int lsst::log::Log::getLevel | ( | ) | const |
Retrieve the logging threshold.
|
static |
Returns logger object for a given name.
If name is empty then current logger is returned and not a root logger.
loggername | Name of logger to return. |
std::string lsst::log::Log::getName | ( | ) | const |
Get the logger name associated with the Log object.
|
inline |
Check whether the logger is enabled for the DEBUG Level
bool lsst::log::Log::isEnabledFor | ( | int | level | ) | const |
Return whether the logging threshold of the logger is less than or equal to LEVEL.
level | Logging threshold to check. |
|
inline |
Check whether the logger is enabled for the ERROR Level
|
inline |
Check whether the logger is enabled for the FATAL Level
|
inline |
Check whether the logger is enabled for the INFO Level
|
inline |
Check whether the logger is enabled for the TRACE Level
|
inline |
Check whether the logger is enabled for the WARN Level
void lsst::log::Log::log | ( | log4cxx::LevelPtr | level, |
log4cxx::spi::LocationInfo const & | location, | ||
char const * | fmt, | ||
... | |||
) |
Method used by LOG_INFO and similar macros to process a log message with variable arguments along with associated metadata.
level | message level |
location | message origin location |
fmt | message format string |
... | message arguments |
void lsst::log::Log::logMsg | ( | log4cxx::LevelPtr | level, |
log4cxx::spi::LocationInfo const & | location, | ||
std::string const & | msg | ||
) |
Method used by LOGS_INFO and similar macros to process a log message.
level | message level |
location | message origin location |
msg | message string |
|
static |
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}
. Note that unlike log4cxx::MDC::put()
this method overwrites any previously existing mapping.
key | Unique key. |
value | String value. |
|
static |
Remove the value associated with KEY within the MDC.
key | Key identifying value to remove. |
void lsst::log::Log::setLevel | ( | int | level | ) |
Set the logging threshold to LEVEL.
level | New logging threshold. |