summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-11-16 22:08:52 +0000
committerAlan Conway <aconway@apache.org>2007-11-16 22:08:52 +0000
commit2c3e3bf4c62267ac6a0fe1f5d6a6288a927ace0b (patch)
treead6ca0683acc9e776f6f9e6dd52c895c024635ca /cpp
parent493b528a6ba5961613d4ecea7b81f5b3638dc3d9 (diff)
downloadqpid-python-2c3e3bf4c62267ac6a0fe1f5d6a6288a927ace0b.tar.gz
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. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@595842 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/qpid/log/Logger.cpp2
-rw-r--r--cpp/src/qpid/log/Options.cpp4
-rw-r--r--cpp/src/qpid/log/Selector.cpp4
-rw-r--r--cpp/src/qpid/log/Selector.h2
4 files changed, 6 insertions, 6 deletions
diff --git a/cpp/src/qpid/log/Logger.cpp b/cpp/src/qpid/log/Logger.cpp
index c483ed2379..fd9ab14c63 100644
--- a/cpp/src/qpid/log/Logger.cpp
+++ b/cpp/src/qpid/log/Logger.cpp
@@ -40,7 +40,7 @@ using namespace std;
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 {
diff --git a/cpp/src/qpid/log/Options.cpp b/cpp/src/qpid/log/Options.cpp
index a945d5eb35..41a15dcf9f 100644
--- a/cpp/src/qpid/log/Options.cpp
+++ b/cpp/src/qpid/log/Options.cpp
@@ -43,13 +43,13 @@ Options::Options(const std::string& name) : qpid::Options(name),
("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")
diff --git a/cpp/src/qpid/log/Selector.cpp b/cpp/src/qpid/log/Selector.cpp
index e8cef2b17d..994421d0ff 100644
--- a/cpp/src/qpid/log/Selector.cpp
+++ b/cpp/src/qpid/log/Selector.cpp
@@ -52,12 +52,12 @@ Selector::Selector(const Options& opt){
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;
diff --git a/cpp/src/qpid/log/Selector.h b/cpp/src/qpid/log/Selector.h
index bba3f05bfc..7c98bc6f8f 100644
--- a/cpp/src/qpid/log/Selector.h
+++ b/cpp/src/qpid/log/Selector.h
@@ -57,7 +57,7 @@ class Selector {
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];