BasicLayout.cpp
Go to the documentation of this file.
00001 /*
00002  * BasicLayout.cpp
00003  *
00004  * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved.
00005  * Copyright 2000, Bastiaan Bakker. All rights reserved.
00006  *
00007  * See the COPYING file for the terms of usage and distribution.
00008  */
00009 
00010 #include "PortabilityImpl.hh"
00011 #include <log4cpp/BasicLayout.hh>
00012 #include <log4cpp/Priority.hh>
00013 #include <log4cpp/FactoryParams.hh>
00014 #ifdef LOG4CPP_HAVE_SSTREAM
00015 #include <sstream>
00016 #endif
00017 #include <memory>
00018 
00019 namespace log4cpp {
00020 
00021     BasicLayout::BasicLayout() {
00022     }
00023     
00024     BasicLayout::~BasicLayout() {
00025     }
00026 
00027     std::string BasicLayout::format(const LoggingEvent& event) {
00028         std::ostringstream message;
00029 
00030         const std::string& priorityName = Priority::getPriorityName(event.priority);
00031         message << event.timeStamp.getSeconds() << " " << priorityName << " " 
00032                 << event.categoryName << " " << event.ndc << ": " 
00033                 << event.message << std::endl;
00034 
00035         return message.str();
00036     }
00037 
00038     std::auto_ptr<Layout> create_basic_layout(const FactoryParams& params)
00039     {
00040        return std::auto_ptr<Layout>(new BasicLayout);
00041     }
00042 }


log4cpp
Author(s): Stephen Roderick, Bastiaan Bakker, Cedric Le Goater, Steve Ostlind, Marcel Harkema, Walter Stroebel, Glenn Scott and Tony Cheung
autogenerated on Sat Jun 8 2019 18:45:46