Commit 231bfc60 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

[2445] put LogBuffer::flush() call into processEnd()

And clean up the process() calls and processSpecification() method (which should mostly look like they were now)
parent f1f6c26a
......@@ -16,6 +16,8 @@
#include <log4cplus/loglevel.h>
#include <boost/scoped_ptr.hpp>
#include <iostream>
namespace isc {
namespace log {
......
......@@ -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
......
......@@ -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.
......
......@@ -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
///
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment