lsst.log
14.0-2-ga5af9b6+11
|
#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 |
bool | isEnabledFor (int level) 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 std::string | getDefaultLoggerName () |
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 void | pushContext (std::string const &name) |
static void | popContext () |
static void | 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. |
|
static |
Get the current default logger name.
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 |
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. |
|
static |
Pops the last pushed name off the global hierarchical default logger name.
|
static |
Pushes NAME onto the global hierarchical default logger name.
name | String to push onto logging context. |
void lsst::log::Log::setLevel | ( | int | level | ) |
Set the logging threshold to LEVEL.
level | New logging threshold. |