]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2169] Fix tree for changes in log4cplus 1.1.0
authorMukund Sivaraman <muks@isc.org>
Wed, 1 Aug 2012 03:16:58 +0000 (08:46 +0530)
committerMukund Sivaraman <muks@isc.org>
Wed, 1 Aug 2012 03:18:24 +0000 (08:48 +0530)
This is based on a patch sent in by John Lumby. Code still compiles and
works with log4cplus 1.0.4.

src/lib/log/logger_impl.cc
src/lib/log/logger_level_impl.cc
src/lib/log/logger_level_impl.h
src/lib/log/logger_manager_impl.cc

index 2d6c0f4a27bc025de4dd2e1f2ab4814efebf217a..6cd3da532e9d765cdab40abdd27babcce95a1bb3 100644 (file)
@@ -22,6 +22,7 @@
 #include <boost/static_assert.hpp>
 
 #include <log4cplus/configurator.h>
+#include <log4cplus/loggingmacros.h>
 
 #include <log/logger.h>
 #include <log/logger_impl.h>
index 397f6d4b76ac2d17eb00228ccf9409ba922bd449..bfc47481989122d48261d69a2a4d4de933c39566 100644 (file)
@@ -185,20 +185,22 @@ LoggerLevelImpl::logLevelFromString(const log4cplus::tstring& level) {
 
 // Convert logging level to string.  If the level is a valid debug level,
 // return the string DEBUG, else return the empty string.
-log4cplus::tstring
+LoggerLevelImpl::LogLevelString
 LoggerLevelImpl::logLevelToString(log4cplus::LogLevel level) {
+    static const tstring debug_string("DEBUG");
+    static const tstring empty_string;
     Level bindlevel = convertToBindLevel(level);
     Severity& severity = bindlevel.severity;
     int& dbglevel = bindlevel.dbglevel;
 
     if ((severity == DEBUG) &&
         ((dbglevel >= MIN_DEBUG_LEVEL) && (dbglevel <= MAX_DEBUG_LEVEL))) {
-        return (tstring("DEBUG"));
+        return (debug_string);
     }
 
     // Unknown, so return empty string for log4cplus to try other conversion
     // functions.
-    return (tstring());
+    return (empty_string);
 }
 
 // Initialization.  Register the conversion functions with the LogLevelManager.
index c9907966a4d80e27dac3c884cb16a06eadac5f69..17b866d6df9d9d152618a6fdbad53841c31c5724 100644 (file)
@@ -16,6 +16,7 @@
 #define __LOGGER_LEVEL_IMPL_H
 
 #include <log4cplus/logger.h>
+#include <log4cplus/version.h>
 #include <log/logger_level.h>
 
 namespace isc {
@@ -65,6 +66,12 @@ namespace log {
 class LoggerLevelImpl {
 public:
 
+#if (LOG4CPLUS_VERSION >= LOG4CPLUS_MAKE_VERSION(1, 1, 0))
+    typedef log4cplus::tstring const & LogLevelString;
+#else
+    typedef log4cplus::tstring LogLevelString;
+#endif
+
     /// \brief Convert BIND 10 level to log4cplus logging level
     ///
     /// Converts the BIND 10 severity level into a log4cplus logging level.
@@ -112,7 +119,7 @@ public:
     /// \param level Extended logging level
     ///
     /// \return Equivalent string.
-    static log4cplus::tstring logLevelToString(log4cplus::LogLevel level);
+    static LogLevelString logLevelToString(log4cplus::LogLevel level);
 
     /// \brief Initialize extended logging levels
     ///
index 68f2bb8b4ffcff97bc88b2f085b95d62a82b208f..1af40c1bc4aa252aa2f8449cab792f9f14a89626 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <log4cplus/logger.h>
 #include <log4cplus/configurator.h>
+#include <log4cplus/hierarchy.h>
 #include <log4cplus/consoleappender.h>
 #include <log4cplus/fileappender.h>
 #include <log4cplus/syslogappender.h>