FileAppender.cpp
Go to the documentation of this file.
2 #include "ocl/Component.hpp"
3 #include <rtt/Logger.hpp>
4 
6 
7 using namespace RTT;
8 
9 namespace OCL {
10 namespace logging {
11 
12 FileAppender::FileAppender(std::string name) :
13  OCL::logging::Appender(name),
14  filename_prop("Filename", "Name of file to log to"),
15  maxEventsPerCycle_prop("MaxEventsPerCycle", "Maximum number of log events to pop per cycle",1),
16  maxEventsPerCycle(1)
17 {
20 }
21 
23 {
24 }
25 
27 {
28  // verify valid limits
30  if ((0 > m))
31  {
32  log(Error) << "Invalid maxEventsPerCycle value of "
33  << m << ". Value must be >= 0."
34  << endlog();
35  return false;
36  }
38 
39  // \todo error checking
40  if (appender)
41  delete appender; // in case the filename changed...
42 
44 
45  return configureLayout();
46 }
47 
49 {
51 }
52 
54 {
55  /* normally in log4cpp the category owns the appenders and deletes them
56  itself, however we don't associate appenders and categories in the
57  same manner. Hence, you have to manually manage appenders.
58  */
59  delete appender;
60  appender = 0;
61 }
62 
63 // namespaces
64 }
65 }
66 
RTT::Property< std::string > filename_prop
Name of file to append to.
log4cpp::Appender * appender
Appender created by derived class.
Definition: Appender.hpp:52
virtual bool configureHook()
Create log4cpp appender.
RTT::Property< int > maxEventsPerCycle_prop
const_reference_t rvalue() const
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
Error
PropertyBag * properties()
ORO_LIST_COMPONENT_TYPE(OCL::logging::GenerationalFileAppender)
virtual void cleanupHook()
Destroy appender.
virtual const std::string & getName() const
virtual void updateHook()
Process at most maxEventsPerCycle event.


ocl
Author(s): OCL Development Team
autogenerated on Mon Mar 23 2020 04:47:19