BIND 10 trac2445, updated. 231bfc60a9327295a2431f7d04ed5a26962d6236 [2445] put LogBuffer::flush() call into processEnd()
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Dec 5 21:31:38 UTC 2012
The branch, trac2445 has been updated
via 231bfc60a9327295a2431f7d04ed5a26962d6236 (commit)
from f1f6c26aa9f45367159229de64ca1545c87d51ac (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 231bfc60a9327295a2431f7d04ed5a26962d6236
Author: Jelte Jansen <jelte at isc.org>
Date: Wed Dec 5 22:30:44 2012 +0100
[2445] put LogBuffer::flush() call into processEnd()
And clean up the process() calls and processSpecification() method (which should mostly look like they were now)
-----------------------------------------------------------------------
Summary of changes:
src/lib/log/log_buffer.cc | 2 ++
src/lib/log/logger_manager.h | 13 ++++---------
src/lib/log/logger_manager_impl.cc | 15 +++++++--------
src/lib/log/logger_manager_impl.h | 3 +--
4 files changed, 14 insertions(+), 19 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/log/log_buffer.cc b/src/lib/log/log_buffer.cc
index 7890226..5c29d20 100644
--- a/src/lib/log/log_buffer.cc
+++ b/src/lib/log/log_buffer.cc
@@ -16,6 +16,8 @@
#include <log4cplus/loglevel.h>
#include <boost/scoped_ptr.hpp>
+#include <iostream>
+
namespace isc {
namespace log {
diff --git a/src/lib/log/logger_manager.h b/src/lib/log/logger_manager.h
index 6320e04..da49ae4 100644
--- a/src/lib/log/logger_manager.h
+++ b/src/lib/log/logger_manager.h
@@ -59,12 +59,8 @@ public:
template <typename T>
void process(T start, T finish) {
processInit();
- if (start == finish) {
- process();
- } else {
- for (T i = start; i != finish; ++i) {
- processSpecification(*i);
- }
+ for (T i = start; i != finish; ++i) {
+ processSpecification(*i);
}
processEnd();
}
@@ -91,9 +87,8 @@ public:
/// but it turns out there are no logging specifications to
/// handle.
void process() {
- // empty iterator; set defaults
- const LoggerSpecification spec;
- process(spec);
+ processInit();
+ processEnd();
}
/// \brief Run-Time Initialization
diff --git a/src/lib/log/logger_manager_impl.cc b/src/lib/log/logger_manager_impl.cc
index 4f961b3..f67116d 100644
--- a/src/lib/log/logger_manager_impl.cc
+++ b/src/lib/log/logger_manager_impl.cc
@@ -48,18 +48,19 @@ LoggerManagerImpl::processInit() {
initRootLogger();
}
+// Flush the LogBuffer at the end of processing a new specification
+void
+LoggerManagerImpl::processEnd() {
+ getLogBuffer().flush();
+}
+
// Process logging specification. Set up the common states then dispatch to
// add output specifications.
void
LoggerManagerImpl::processSpecification(const LoggerSpecification& spec) {
log4cplus::Logger logger;
// If this is an 'empty' specification, just set the root logger
- if (spec.getName() == "") {
- logger = log4cplus::Logger::getInstance(getRootLoggerName());
- } else {
- logger = log4cplus::Logger::getInstance(
- expandLoggerName(spec.getName()));
- }
+ logger = log4cplus::Logger::getInstance(expandLoggerName(spec.getName()));
// Set severity level according to specification entry.
logger.setLogLevel(LoggerLevelImpl::convertFromBindLevel(
@@ -100,8 +101,6 @@ LoggerManagerImpl::processSpecification(const LoggerSpecification& spec) {
}
}
}
- // Should anything be left in the buffer, this is the time to flush it.
- getLogBuffer().flush();
}
// Console appender - log to either stdout or stderr.
diff --git a/src/lib/log/logger_manager_impl.h b/src/lib/log/logger_manager_impl.h
index 6302ac7..ef6f811 100644
--- a/src/lib/log/logger_manager_impl.h
+++ b/src/lib/log/logger_manager_impl.h
@@ -70,8 +70,7 @@ public:
/// \brief End Processing
///
/// Terminates the processing of the logging specifications.
- static void processEnd()
- {}
+ static void processEnd();
/// \brief Implementation-specific initialization
///
More information about the bind10-changes
mailing list