12#include <boost/lexical_cast.hpp>
14#include <log4cplus/logger.h>
36 static const log4cplus::LogLevel log4cplus_levels[] = {
37 log4cplus::NOT_SET_LOG_LEVEL,
38 log4cplus::DEBUG_LOG_LEVEL,
39 log4cplus::INFO_LOG_LEVEL,
40 log4cplus::WARN_LOG_LEVEL,
41 log4cplus::ERROR_LOG_LEVEL,
42 log4cplus::FATAL_LOG_LEVEL,
43 log4cplus::OFF_LOG_LEVEL
47 BOOST_STATIC_ASSERT(
static_cast<int>(
DEFAULT) == 0);
48 BOOST_STATIC_ASSERT(
static_cast<int>(
DEBUG) == 1);
49 BOOST_STATIC_ASSERT(
static_cast<int>(
INFO) == 2);
50 BOOST_STATIC_ASSERT(
static_cast<int>(
WARN) == 3);
51 BOOST_STATIC_ASSERT(
static_cast<int>(
ERROR) == 4);
52 BOOST_STATIC_ASSERT(
static_cast<int>(
FATAL) == 5);
53 BOOST_STATIC_ASSERT(
static_cast<int>(
NONE) == 6);
56 if (level.severity ==
DEBUG) {
64 LogLevel newlevel =
static_cast<int>(DEBUG_LOG_LEVEL -
66 return (
static_cast<log4cplus::LogLevel
>(newlevel));
74 return (log4cplus_levels[level.severity]);
85 if (loglevel <= log4cplus::NOT_SET_LOG_LEVEL) {
88 }
else if (loglevel <= log4cplus::DEBUG_LOG_LEVEL) {
94 static_cast<int>(log4cplus::DEBUG_LOG_LEVEL) -
95 static_cast<int>(loglevel);
103 }
else if (loglevel <= log4cplus::INFO_LOG_LEVEL) {
106 }
else if (loglevel <= log4cplus::WARN_LOG_LEVEL) {
109 }
else if (loglevel <= log4cplus::ERROR_LOG_LEVEL) {
112 }
else if (loglevel <= log4cplus::FATAL_LOG_LEVEL) {
125 std::string name = level;
126 size_t length = name.size();
132 return (NOT_SET_LOG_LEVEL);
134 if (strncasecmp(name.c_str(),
"DEBUG", 5) == 0) {
141 return (DEBUG_LOG_LEVEL);
150 int dbglevel = boost::lexical_cast<int>(name.substr(5));
164 catch (
const boost::bad_lexical_cast&) {
166 return (NOT_SET_LOG_LEVEL);
173 return (NOT_SET_LOG_LEVEL);
180#if LOG4CPLUS_VERSION < LOG4CPLUS_MAKE_VERSION(2, 0, 0)
187 Severity& severity = bindlevel.severity;
188 int& dbglevel = bindlevel.dbglevel;
192 if ((severity ==
DEBUG) &&
207 LogLevelManager& manager = getLogLevelManager();
static log4cplus::LogLevel convertFromBindLevel(const isc::log::Level &level)
Convert Kea level to log4cplus logging level.
static const LogLevelString & logLevelToString(log4cplus::LogLevel level)
Convert log level to string.
static log4cplus::LogLevel logLevelFromString(const log4cplus::tstring &level)
Convert string to log4cplus logging level.
log4cplus::tstring LogLevelString
static isc::log::Level convertToBindLevel(const log4cplus::LogLevel loglevel)
Convert log4cplus logging level to Kea logging level.
static void init()
Initialize extended logging levels.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
#define LOG_WARN(LOGGER, MESSAGE)
Macro to conveniently test warn output and log it.
isc::log::Logger logger("asiodns")
Use the ASIO logger.
const isc::log::MessageID LOGIMPL_BAD_DEBUG_STRING
const isc::log::MessageID LOGIMPL_BELOW_MIN_DEBUG
const isc::log::MessageID LOGIMPL_ABOVE_MAX_DEBUG
const int MAX_DEBUG_LEVEL
const int MIN_DEBUG_LEVEL
Minimum/maximum debug levels.
Defines the logger used by the top-level component of kea-lfc.