1 /* 2 * BasicLayout.cpp 3 * 4 * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 * 7 * See the COPYING file for the terms of usage and distribution. 8 */ 9 10 #include "PortabilityImpl.hh" 11 #include <log4cpp/BasicLayout.hh> 12 #include <log4cpp/Priority.hh> 13 #include <log4cpp/FactoryParams.hh> 14 #include <memory> 15 16 #ifdef LOG4CPP_HAVE_SSTREAM 17 #include <sstream> 18 #endif 19 20 namespace log4cpp { 21 BasicLayout()22 BasicLayout::BasicLayout() { 23 } 24 ~BasicLayout()25 BasicLayout::~BasicLayout() { 26 } 27 format(const LoggingEvent & event)28 std::string BasicLayout::format(const LoggingEvent& event) { 29 std::ostringstream message; 30 31 const std::string& priorityName = Priority::getPriorityName(event.priority); 32 message << event.timeStamp.getSeconds() << " " << priorityName << " " 33 << event.categoryName << " " << event.ndc << ": " 34 << event.message << std::endl; 35 36 return message.str(); 37 } 38 create_basic_layout(const FactoryParams & params)39 std::auto_ptr<Layout> create_basic_layout(const FactoryParams& params) 40 { 41 return std::auto_ptr<Layout>(new BasicLayout); 42 } 43 } 44