OstreamAppender.cpp
Go to the documentation of this file.
2 #include "ocl/Component.hpp"
3 
5 
6 using namespace RTT;
7 
8 namespace OCL {
9 namespace logging {
10 
11 OstreamAppender::OstreamAppender(std::string name) :
12  OCL::logging::Appender(name),
13  maxEventsPerCycle_prop("MaxEventsPerCycle", "Maximum number of log events to pop per cycle",1),
14  maxEventsPerCycle(1)
15 {
17 }
18 
20 {
21 }
22 
24 {
25  // verify valid limits
27  if ((0 > m))
28  {
29  log(Error) << "Invalid maxEventsPerCycle value of "
30  << m << ". Value must be >= 0."
31  << endlog();
32  return false;
33  }
35 
36  if (!appender)
37  appender = new log4cpp::OstreamAppender(getName(), &std::cout);
38 
39  return configureLayout();
40 }
41 
43 {
44  processEvents(1);
45 }
46 
48 {
49  /* normally in log4cpp the category owns the appenders and deletes them
50  itself, however we don't associate appenders and categories in the
51  same manner. Hence, you have to manually manage appenders.
52  */
53  delete appender;
54  appender = 0;
55 }
56 
57 // namespaces
58 }
59 }
60 
virtual bool configureHook()
Create log4cpp appender.
RTT::Property< int > maxEventsPerCycle_prop
log4cpp::Appender * appender
Appender created by derived class.
Definition: Appender.hpp:52
virtual void updateHook()
Process at most one (1) event.
const_reference_t rvalue() const
virtual void cleanupHook()
Destroy appender.
virtual bool configureLayout()
Definition: Appender.cpp:29
Property< T > & addProperty(const std::string &name, T &attr)
virtual void processEvents(int n)
Definition: Appender.cpp:104
ORO_LIST_COMPONENT_TYPE(OCL::logging::OstreamAppender)
Error
PropertyBag * properties()
virtual const std::string & getName() const


ocl
Author(s): OCL Development Team
autogenerated on Wed Jun 26 2019 19:26:27