00001 #ifndef APPENDER_HPP 00002 #define APPENDER_HPP 1 00003 00004 #include <rtt/TaskContext.hpp> 00005 #include <rtt/Port.hpp> 00006 #include "LoggingEvent.hpp" 00007 00008 // forward declare 00009 namespace log4cpp { 00010 class Appender; 00011 } 00012 00013 namespace OCL { 00014 namespace logging { 00015 00016 class Appender : public RTT::TaskContext 00017 { 00018 public: 00019 Appender(std::string name); 00020 virtual ~Appender(); 00021 00027 virtual bool configureLayout(); 00029 virtual bool startHook(); 00031 virtual void stopHook(); 00032 00035 virtual void drainBuffer(); 00036 00037 protected: 00043 virtual void processEvents(int n); 00044 00047 RTT::InputPort<OCL::logging::LoggingEvent> log_port; 00048 00050 log4cpp::Appender* appender; 00051 00052 // support layouts for all appenders 00054 RTT::Property<std::string> layoutName_prop; 00056 RTT::Property<std::string> layoutPattern_prop; 00057 00058 // diagnostic: count number of times popped max events 00059 unsigned int countMaxPopped; 00060 }; 00061 00062 // namespaces 00063 } 00064 } 00065 00066 #endif