Browse Source

[master] Merge branch 'trac4494_new'

Stephen Morris 8 years ago
parent
commit
023c2fc368

+ 2 - 4
src/lib/log/logger_level_impl.cc

@@ -179,20 +179,18 @@ LoggerLevelImpl::logLevelFromString(const log4cplus::tstring& level) {
 // return the string DEBUG, else return the empty string.
 // return the string DEBUG, else return the empty string.
 LoggerLevelImpl::LogLevelString
 LoggerLevelImpl::LogLevelString
 LoggerLevelImpl::logLevelToString(log4cplus::LogLevel level) {
 LoggerLevelImpl::logLevelToString(log4cplus::LogLevel level) {
-    static const tstring debug_string("DEBUG");
-    static const tstring empty_string;
     Level bindlevel = convertToBindLevel(level);
     Level bindlevel = convertToBindLevel(level);
     Severity& severity = bindlevel.severity;
     Severity& severity = bindlevel.severity;
     int& dbglevel = bindlevel.dbglevel;
     int& dbglevel = bindlevel.dbglevel;
 
 
     if ((severity == DEBUG) &&
     if ((severity == DEBUG) &&
         ((dbglevel >= MIN_DEBUG_LEVEL) && (dbglevel <= MAX_DEBUG_LEVEL))) {
         ((dbglevel >= MIN_DEBUG_LEVEL) && (dbglevel <= MAX_DEBUG_LEVEL))) {
-        return (debug_string);
+        return (tstring("DEBUG"));
     }
     }
 
 
     // Unknown, so return empty string for log4cplus to try other conversion
     // Unknown, so return empty string for log4cplus to try other conversion
     // functions.
     // functions.
-    return (empty_string);
+    return (tstring());
 }
 }
 
 
 // Initialization.  Register the conversion functions with the LogLevelManager.
 // Initialization.  Register the conversion functions with the LogLevelManager.

+ 1 - 5
src/lib/log/logger_level_impl.h

@@ -58,11 +58,7 @@ namespace log {
 class LoggerLevelImpl {
 class LoggerLevelImpl {
 public:
 public:
 
 
-#if (LOG4CPLUS_VERSION >= LOG4CPLUS_MAKE_VERSION(1, 1, 0))
-    typedef log4cplus::tstring const & LogLevelString;
-#else
-    typedef log4cplus::tstring LogLevelString;
-#endif
+typedef log4cplus::tstring LogLevelString;
 
 
     /// \brief Convert Kea level to log4cplus logging level
     /// \brief Convert Kea level to log4cplus logging level
     ///
     ///

+ 6 - 2
src/lib/log/message_dictionary.cc

@@ -13,6 +13,11 @@ using namespace std;
 namespace isc {
 namespace isc {
 namespace log {
 namespace log {
 
 
+// Constructor
+
+MessageDictionary::MessageDictionary() : dictionary_(), empty_("") {
+}
+
 // (Virtual) Destructor
 // (Virtual) Destructor
 
 
 MessageDictionary::~MessageDictionary() {
 MessageDictionary::~MessageDictionary() {
@@ -91,10 +96,9 @@ MessageDictionary::load(const char* messages[]) {
 
 
 const string&
 const string&
 MessageDictionary::getText(const std::string& ident) const {
 MessageDictionary::getText(const std::string& ident) const {
-    static const string empty("");
     Dictionary::const_iterator i = dictionary_.find(ident);
     Dictionary::const_iterator i = dictionary_.find(ident);
     if (i == dictionary_.end()) {
     if (i == dictionary_.end()) {
-        return (empty);
+        return (empty_);
     }
     }
     else {
     else {
         return (i->second);
         return (i->second);

+ 3 - 1
src/lib/log/message_dictionary.h

@@ -50,7 +50,8 @@ public:
     typedef std::map<std::string, std::string> Dictionary;
     typedef std::map<std::string, std::string> Dictionary;
     typedef Dictionary::const_iterator  const_iterator;
     typedef Dictionary::const_iterator  const_iterator;
 
 
-    // Default constructor and assignment operator are OK for this class
+    /// \brief Constructor
+    MessageDictionary();
 
 
     /// \brief Virtual Destructor
     /// \brief Virtual Destructor
     virtual ~MessageDictionary();
     virtual ~MessageDictionary();
@@ -198,6 +199,7 @@ public:
 
 
 private:
 private:
     Dictionary       dictionary_;   ///< Holds the ID to text lookups
     Dictionary       dictionary_;   ///< Holds the ID to text lookups
+    const std::string empty_;       ///< Empty string
 };
 };
 
 
 } // namespace log
 } // namespace log