SimpleLayout.cpp
Go to the documentation of this file.
00001 /*
00002  * SimpleLayout.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/SimpleLayout.hh>
00012 #include <log4cpp/Priority.hh>
00013 #include <ios>
00014 #ifdef LOG4CPP_HAVE_SSTREAM
00015 #include <sstream>
00016 #endif
00017 
00018 #include <memory>
00019 #include <log4cpp/FactoryParams.hh>
00020 
00021 namespace log4cpp {
00022 
00023     SimpleLayout::SimpleLayout() {
00024     }
00025     
00026     SimpleLayout::~SimpleLayout() {
00027     }
00028 
00029     std::string SimpleLayout::format(const LoggingEvent& event) {
00030         std::ostringstream message;
00031 
00032         const std::string& priorityName = Priority::getPriorityName(event.priority);
00033                 message.width(Priority::MESSAGE_SIZE);message.setf(std::ios::left);
00034                 message << priorityName << ": " << event.message << std::endl;
00035         return message.str();
00036     }
00037 
00038    std::auto_ptr<Layout> create_simple_layout(const FactoryParams& params)
00039    {
00040       return std::auto_ptr<Layout>(new SimpleLayout);
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 Sun Aug 14 2016 03:18:26