summaryrefslogtreecommitdiff
path: root/qpid/cpp/include
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2010-11-17 19:12:08 +0000
committerAlan Conway <aconway@apache.org>2010-11-17 19:12:08 +0000
commitcac1b88440584a9d69a212f01486bc9041278c66 (patch)
tree968369037afb7d24f2190ba8ce9836a441a75b75 /qpid/cpp/include
parentfc6aadb2c6ac51c7ff85955a0285efab1fd805df (diff)
downloadqpid-python-cac1b88440584a9d69a212f01486bc9041278c66.tar.gz
Aggregate Timer warnings.
The Timer code logs a warning if a timer callback is started late or overruns the start time for the next callback. In cases where there are a lot of these warnings, the time taken to do the logging itself severly worsens the situation. This commit aggregates timer warnings and give a statistical report every 5 seconds at most. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1036169 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/include')
-rw-r--r--qpid/cpp/include/qpid/log/Statement.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/qpid/cpp/include/qpid/log/Statement.h b/qpid/cpp/include/qpid/log/Statement.h
index 8f73175630..7b3ab60b81 100644
--- a/qpid/cpp/include/qpid/log/Statement.h
+++ b/qpid/cpp/include/qpid/log/Statement.h
@@ -96,6 +96,24 @@ struct Statement {
} while(0)
/**
+ * FLAG must be a boolean variable. Assigns FLAG to true iff logging
+ * is enabled for LEVEL in the calling context. Use when extra
+ * support code is needed to generate log messages, to ensure that it
+ * is only run if the logging level is enabled.
+ * e.g.
+ * bool logWarning;
+ * QPID_LOG_TEST(LEVEL, logWarning);
+ * if (logWarning) { do stuff needed for warning log messages }
+ */
+#define QPID_LOG_TEST(LEVEL, FLAG) \
+ do { \
+ using ::qpid::log::Statement; \
+ static Statement stmt_= QPID_LOG_STATEMENT_INIT(LEVEL); \
+ static Statement::Initializer init_(stmt_); \
+ FLAG = stmt_.enabled; \
+ } while(0)
+
+/**
* Macro for log statements. Example of use:
* @code
* QPID_LOG(debug, "There are " << foocount << " foos in the bar.");