11#include <log4cplus/loglevel.h>
12#include <log4cplus/version.h>
13#include <boost/scoped_ptr.hpp>
35BufferAppender::flushStdout() {
42 for (
auto const& it : stored_) {
43 const std::string level(it.first);
45 std::printf(
"%s [%s]: %s\n", level.c_str(),
46 event->getLoggerName().c_str(),
47 event->getMessage().c_str());
55 stored_.swap(stored_copy);
57 for (
auto const& it : stored_copy) {
59 log4cplus::Logger logger =
60 log4cplus::Logger::getInstance(event->getLoggerName());
62 logger.log(event->getLogLevel(), event->getMessage());
69 return (stored_.size());
76 "Internal log buffer has been flushed already");
79#if LOG4CPLUS_VERSION < LOG4CPLUS_MAKE_VERSION(2, 0, 0)
80 std::auto_ptr<log4cplus::spi::InternalLoggingEvent>
82 std::unique_ptr<log4cplus::spi::InternalLoggingEvent>
84 event_aptr =
event.clone();
88 log4cplus::LogLevelManager().toString(event.getLogLevel()),
size_t getBufferSize() const
Returns the number of stored logging events.
virtual ~BufferAppender()
Destructor.
virtual void append(const log4cplus::spi::InternalLoggingEvent &event)
void flush()
Flush the internal buffer.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
std::pair< std::string, LogEventPtr > LevelAndEvent
Convenience typedef for a pair string/logeventptr, the string representing the logger level,...
std::vector< LevelAndEvent > LogEventList
Convenience typedef for a vector of LevelAndEvent instances.
boost::shared_ptr< log4cplus::spi::InternalLoggingEvent > LogEventPtr
Convenience typedef for a pointer to a log event.
Defines the logger used by the top-level component of kea-lfc.