#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.
|
#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 |
|
#define LOG |
( |
|
logger, |
|
|
|
level, |
|
|
|
message... |
|
) |
| |
Value:
__BASE_FILE__, __PRETTY_FUNCTION__, __LINE__, message); } \
} while (false)
static bool isEnabledFor(log4cxx::LoggerPtr logger, int level)
static void log(std::string const &loggername, log4cxx::LevelPtr level, std::string const &filename, std::string const &funcname, unsigned int lineno, char const *fmt,...)
Log a message using a varargs/printf style interface.
- Parameters
-
logger | Either name of logger or log4cxx logger object. |
level | Logging level associated with message. |
message | An sprintf-compatible format string followed by zero, one, or more comma-separated arguments. |
Definition at line 339 of file Log.h.
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.
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.
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.
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.
Return whether the logging threshold of LOGGER is less than or equal to LEVEL.
- Returns
- Bool indicating whether or not logger is enabled.
- Parameters
-
logger | Either name of logger or log4cxx logger being queried. |
level | Logging threshold to check. |
Definition at line 160 of file Log.h.
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.
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.
Configures log4cxx and initializes logging module.
- Parameters
-
filename | Path to configuration file. |
Definition at line 52 of file Log.h.
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
-
string | List of properties (lines separated by new line character) |
Definition at line 66 of file Log.h.
#define LOG_DEBUG |
( |
|
message... | ) |
|
Value:
log4cxx::Level::getDebug(), __BASE_FILE__, __PRETTY_FUNCTION__, \
__LINE__, message); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
static void log(std::string const &loggername, log4cxx::LevelPtr level, std::string const &filename, std::string const &funcname, unsigned int lineno, char const *fmt,...)
Log a debug-level message to the default logger using a varargs/printf style interface.
- Parameters
-
message | An sprintf-compatible format string followed by zero, one, or more comma-separated arguments. |
Definition at line 368 of file Log.h.
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:
log4cxx::Level::getError(), __BASE_FILE__, __PRETTY_FUNCTION__, \
__LINE__, message); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
static void log(std::string const &loggername, log4cxx::LevelPtr level, std::string const &filename, std::string const &funcname, unsigned int lineno, char const *fmt,...)
Log a error-level message to the default logger using a varargs/printf style interface.
- Parameters
-
message | An 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:
log4cxx::Level::getFatal(), __BASE_FILE__, __PRETTY_FUNCTION__, \
__LINE__, message); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
static void log(std::string const &loggername, log4cxx::LevelPtr level, std::string const &filename, std::string const &funcname, unsigned int lineno, char const *fmt,...)
Log a fatal-level message to the default logger using a varargs/printf style interface.
- Parameters
-
message | An sprintf-compatible format string followed by zero, one, or more comma-separated arguments. |
Definition at line 428 of file Log.h.
Returns a pointer to the log4cxx logger object associated with logger.
- Returns
- log4cxx::LoggerPtr corresponding to logger.
- Parameters
-
logger | Either a logger name or a log4cxx logger object. |
Definition at line 82 of file Log.h.
Retrieve the logging threshold for LOGGER.
- Returns
- int Indicating the logging threshold.
- Parameters
-
logger | Either name of logger or log4cxx logger with threshold to return. |
Definition at line 148 of file Log.h.
#define LOG_INFO |
( |
|
message... | ) |
|
Value:
__LINE__, message); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
static void log(std::string const &loggername, log4cxx::LevelPtr level, std::string const &filename, std::string const &funcname, unsigned int lineno, char const *fmt,...)
Log a info-level message to the default logger using a varargs/printf style interface.
- Parameters
-
message | An 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 |
#define LOG_LVL_DEBUG static_cast<int>(log4cxx::Level::DEBUG_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_LVL_INFO static_cast<int>(log4cxx::Level::INFO_INT) |
#define LOG_LVL_TRACE static_cast<int>(log4cxx::Level::TRACE_INT) |
#define LOG_LVL_WARN static_cast<int>(log4cxx::Level::WARN_INT) |
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
-
key | Unique key. |
value | String value. |
Definition at line 120 of file Log.h.
Remove the value associated with KEY within the MDC.
- Parameters
-
key | Key identifying value to remove. |
Definition at line 128 of file Log.h.
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.
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
-
name | String to push onto logging context. |
- Exceptions
-
std::invalid_argument | raised for empty name or when name contains dot. |
Definition at line 99 of file Log.h.
Set the logging threshold for LOGGER to LEVEL.
- Parameters
-
logger | Logger with threshold to adjust. |
level | New logging threshold. |
Definition at line 137 of file Log.h.
#define LOG_TRACE |
( |
|
message... | ) |
|
Value:
log4cxx::Level::getTrace(), __BASE_FILE__, __PRETTY_FUNCTION__, \
__LINE__, message); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
static void log(std::string const &loggername, log4cxx::LevelPtr level, std::string const &filename, std::string const &funcname, unsigned int lineno, char const *fmt,...)
Log a trace-level message to the default logger using a varargs/printf style interface.
- Parameters
-
message | An 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:
log4cxx::Level::getWarn(), __BASE_FILE__, __PRETTY_FUNCTION__, \
__LINE__, message); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
static void log(std::string const &loggername, log4cxx::LevelPtr level, std::string const &filename, std::string const &funcname, unsigned int lineno, char const *fmt,...)
Log a warn-level message to the default logger using a varargs/printf style interface.
- Parameters
-
message | An 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:
lsst::log::detail::LogFormatter fmter_;
\
log4cxx::Level::toLevel(level), (fmter_ % message).str(), \
LOG4CXX_LOCATION); } \
} while (false)
static log4cxx::LoggerPtr getLogger(log4cxx::LoggerPtr logger)
static bool isEnabledFor(log4cxx::LoggerPtr logger, int level)
Log a message using a boost::format style interface.
- Parameters
-
logger | Either name of logger or log4cxx logger object. |
level | Logging level associated with message. |
message | A 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:
lsst::log::detail::LogFormatter fmter_;
\
log4cxx::Level::getDebug(), (fmter_ % message).str(), \
LOG4CXX_LOCATION); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
Log a debug-level message to the default logger using a boost::format style interface.
- Parameters
-
message | A 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:
lsst::log::detail::LogFormatter fmter_;
\
log4cxx::Level::getError(), (fmter_ % message).str(), \
LOG4CXX_LOCATION); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
Log a error-level message to the default logger using a boost::format style interface.
- Parameters
-
message | A 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:
lsst::log::detail::LogFormatter fmter_;
\
log4cxx::Level::getFatal(), (fmter_ % message).str(), \
LOG4CXX_LOCATION); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
Log a fatal-level message to the default logger using a boost::format style interface.
- Parameters
-
message | A 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:
lsst::log::detail::LogFormatter fmter_;
\
LOG4CXX_LOCATION); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
Log a info-level message to the default logger using a boost::format style interface.
- Parameters
-
message | A 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:
lsst::log::detail::LogFormatter fmter_;
\
log4cxx::Level::getTrace(), (fmter_ % message).str(), \
LOG4CXX_LOCATION); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
Log a trace-level message to the default logger using a boost::format style interface.
- Parameters
-
message | A 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:
lsst::log::detail::LogFormatter fmter_;
\
log4cxx::Level::getWarn(), (fmter_ % message).str(), \
LOG4CXX_LOCATION); } \
} while (false)
static log4cxx::LoggerPtr defaultLogger
Log a warn-level message to the default logger using a boost::format style interface.
- Parameters
-
message | A boost::format compatible format string followed by zero, one, or more arguments separated by % . |
Definition at line 290 of file Log.h.