Browse Source

[trac899] Changes as a result of review

Stephen Morris 14 years ago
parent
commit
5538d85d75
3 changed files with 11 additions and 6 deletions
  1. 10 3
      src/lib/log/log_formatter.h
  2. 1 1
      src/lib/log/logger_level.h
  3. 0 2
      src/lib/log/tests/logger_unittest.cc

+ 10 - 3
src/lib/log/log_formatter.h

@@ -140,9 +140,16 @@ public:
     /// \brief String version of arg.
     /// \brief String version of arg.
     Formatter& arg(const std::string& arg) {
     Formatter& arg(const std::string& arg) {
         if (logger_) {
         if (logger_) {
-            // Note that if we had a message like "%1 %2" and called
-            // .arg(42).arg("%1"), we would get "42 %1" (i.e. no recursive
-            // replacements).  This is a limitation but not a problem.
+            // Note that this method does a replacement and returns the
+            // modified string. If there are multiple invocations of arg() (e.g.
+            // . logger.info(msgid).arg(xxx).arg(yyy)...), each invocation
+            // operates on the string returned by the previous one. This
+            // sequential operation means that if we had a message like "%1 %2",
+            // and called .arg("%2").arg(42), we would get "42 42"; the first
+            // call replaces the %1" with "%2" and the second replaces all
+            // occurrences of "%2" with 42. (Conversely, the sequence
+            // .arg(42).arg("%1") would return "42 %1" - there are no recursive
+            // replacements).
             replacePlaceholder(message_, arg, ++nextPlaceholder_ );
             replacePlaceholder(message_, arg, ++nextPlaceholder_ );
         }
         }
         return (*this);
         return (*this);

+ 1 - 1
src/lib/log/logger_level.h

@@ -36,7 +36,7 @@ typedef enum {
     NONE = 6    // Disable logging
     NONE = 6    // Disable logging
 } Severity;
 } Severity;
 
 
-/// Minimum/maximum debug levels.  These are defined wi
+/// Minimum/maximum debug levels.
 
 
 const int MIN_DEBUG_LEVEL = 0;
 const int MIN_DEBUG_LEVEL = 0;
 const int MAX_DEBUG_LEVEL = 99;
 const int MAX_DEBUG_LEVEL = 99;

+ 0 - 2
src/lib/log/tests/logger_unittest.cc

@@ -34,8 +34,6 @@ class DerivedLogger : public isc::log::Logger {
 public:
 public:
     DerivedLogger(std::string name) : isc::log::Logger(name)
     DerivedLogger(std::string name) : isc::log::Logger(name)
     {}
     {}
-    virtual ~DerivedLogger()
-    {}
 
 
     static void reset() {
     static void reset() {
         isc::log::Logger::reset();
         isc::log::Logger::reset();