You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2007/11/16 23:08:54 UTC

svn commit: r595842 - in /incubator/qpid/trunk/qpid/cpp/src/qpid/log: Logger.cpp Options.cpp Selector.cpp Selector.h

Author: aconway
Date: Fri Nov 16 14:08:52 2007
New Revision: 595842

URL: http://svn.apache.org/viewvc?rev=595842&view=rev
Log:
Logging change: --log-enable level:pattern now does a
substring match of pattern on the function name,
instead of the file name. Allows more precise log filtering.

Modified:
    incubator/qpid/trunk/qpid/cpp/src/qpid/log/Logger.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/log/Options.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/log/Selector.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/log/Selector.h

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/log/Logger.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/log/Logger.cpp?rev=595842&r1=595841&r2=595842&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/log/Logger.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/log/Logger.cpp Fri Nov 16 14:08:52 2007
@@ -40,7 +40,7 @@
 typedef sys::Mutex::ScopedLock ScopedLock;
 
 inline void Logger::enable_unlocked(Statement* s) {
-    s->enabled=selector.isEnabled(s->level, s->file);
+    s->enabled=selector.isEnabled(s->level, s->function);
 }
 
 struct OstreamOutput : public Logger::Output {

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/log/Options.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/log/Options.cpp?rev=595842&r1=595841&r2=595842&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/log/Options.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/log/Options.cpp Fri Nov 16 14:08:52 2007
@@ -43,13 +43,13 @@
         ("trace,t", optValue(trace), "Enables all logging" )
         ("log-enable", optValue(selectors, "RULE"),
          ("Enables logging for selected levels and components. " 
-         "RULE is in the form 'LEVEL[+][:COMPONENT]' "
+         "RULE is in the form 'LEVEL[+][:PATTERN]' "
          "Levels are one of: \n\t "+levels.str()+"\n"
          "For example:\n"
          "\t'--log-enable warning+' "
          "logs all warning, error and critical messages.\n"
          "\t'--log-enable debug:framing' "
-          "logs debug messages from the framing component. "
+          "logs debug messages from the framing namespace. "
          "This option can be used multiple times").c_str())
         ("log-time", optValue(time, "yes|no"),
          "Include time in log messages")

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/log/Selector.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/log/Selector.cpp?rev=595842&r1=595841&r2=595842&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/log/Selector.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/log/Selector.cpp Fri Nov 16 14:08:52 2007
@@ -52,12 +52,12 @@
              boost::bind(&Selector::enable, this, _1));
 }
 
-bool Selector::isEnabled(Level level, const std::string& file) {
+bool Selector::isEnabled(Level level, const std::string& function) {
     for (std::vector<std::string>::iterator i=substrings[level].begin();
          i != substrings[level].end();
          ++i)
     {
-        if (file.find(*i) != std::string::npos)
+        if (function.find(*i) != std::string::npos)
             return true;
     }
     return false;

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/log/Selector.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/log/Selector.h?rev=595842&r1=595841&r2=595842&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/log/Selector.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/log/Selector.h Fri Nov 16 14:08:52 2007
@@ -57,7 +57,7 @@
     void enable(const std::string& enableStr);
 
     /** True if level is enabld for file. */
-    bool isEnabled(Level level, const std::string& file);
+    bool isEnabled(Level level, const std::string& function);
 
   private:
     std::vector<std::string> substrings[LevelTraits::COUNT];