11 #include <log4cplus/loglevel.h>
12 #include <log4cplus/version.h>
13 #include <boost/scoped_ptr.hpp>
35 BufferAppender::flushStdout() {
42 LogEventList::const_iterator it;
43 for (it = stored_.begin(); it != stored_.end(); ++it) {
44 const std::string level(it->first);
46 std::printf(
"%s [%s]: %s\n", level.c_str(),
47 event->getLoggerName().c_str(),
48 event->getMessage().c_str());
56 stored_.swap(stored_copy);
58 LogEventList::const_iterator it;
59 for (it = stored_copy.begin(); it != stored_copy.end(); ++it) {
62 log4cplus::Logger::getInstance(event->getLoggerName());
64 logger.log(event->getLogLevel(),
event->getMessage());
71 return (stored_.size());
78 "Internal log buffer has been flushed already");
81 #if LOG4CPLUS_VERSION < LOG4CPLUS_MAKE_VERSION(2, 0, 0)
82 std::auto_ptr<log4cplus::spi::InternalLoggingEvent>
84 std::unique_ptr<log4cplus::spi::InternalLoggingEvent>
86 event_aptr =
event.clone();
90 log4cplus::LogLevelManager().toString(event.getLogLevel()),
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.
size_t getBufferSize() const
Returns the number of stored logging events.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
virtual void append(const log4cplus::spi::InternalLoggingEvent &event)
virtual ~BufferAppender()
Destructor.
std::pair< std::string, LogEventPtr > LevelAndEvent
Convenience typedef for a pair string/logeventptr, the string representing the logger level...
Defines the logger used by the top-level component of kea-dhcp-ddns.
isc::log::Logger logger("asiodns")
Use the ASIO logger.
void flush()
Flush the internal buffer.