summaryrefslogtreecommitdiff
path: root/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
commit09ff9252575e076375d1e414126466459c21e6d3 (patch)
tree092324a280d1f30487172b0defd90f66077c23fc /cpp/include
parent881fc4aa64127af9a199b9d58d852f7ffe6bc79d (diff)
downloadqpid-python-09ff9252575e076375d1e414126466459c21e6d3.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/qpid@1036169 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/include')
-rw-r--r--cpp/include/qpid/log/Statement.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/cpp/include/qpid/log/Statement.h b/cpp/include/qpid/log/Statement.h
index 8f73175630..7b3ab60b81 100644
--- a/cpp/include/qpid/log/Statement.h
+++ b/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.");