SimpleLayout.cpp
Go to the documentation of this file.
1 /*
2  * SimpleLayout.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/SimpleLayout.hh>
12 #include <log4cpp/Priority.hh>
13 #include <ios>
14 #ifdef LOG4CPP_HAVE_SSTREAM
15 #include <sstream>
16 #endif
17 
18 #include <memory>
19 #include <log4cpp/FactoryParams.hh>
20 
21 namespace log4cpp {
22 
24  }
25 
27  }
28 
29  std::string SimpleLayout::format(const LoggingEvent& event) {
30  std::ostringstream message;
31 
32  const std::string& priorityName = Priority::getPriorityName(event.priority);
33  message.width(Priority::MESSAGE_SIZE);message.setf(std::ios::left);
34  message << priorityName << ": " << event.message << std::endl;
35  return message.str();
36  }
37 
38  std::auto_ptr<Layout> create_simple_layout(const FactoryParams& params)
39  {
40  return std::auto_ptr<Layout>(new SimpleLayout);
41  }
42 }
std::auto_ptr< Layout > create_simple_layout(const FactoryParams &params)
virtual std::string format(const LoggingEvent &event)
static const int MESSAGE_SIZE
Definition: Priority.hh:64
Priority::Value priority
Definition: LoggingEvent.hh:67
LOG4CPP_EXPORT CategoryStream & left(CategoryStream &os)
static const std::string & getPriorityName(int priority)
Definition: Priority.cpp:37


log4cpp
Author(s): Stephen Roderick, Bastiaan Bakker, Cedric Le Goater, Steve Ostlind, Marcel Harkema, Walter Stroebel, Glenn Scott and Tony Cheung
autogenerated on Sun Jun 23 2019 19:14:17