Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
logging
OstreamAppender.cpp
Go to the documentation of this file.
1
#include "
logging/OstreamAppender.hpp
"
2
#include "
ocl/Component.hpp
"
3
4
#include <
log4cpp/OstreamAppender.hh
>
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
{
16
properties
()->
addProperty
(
maxEventsPerCycle_prop
);
17
}
18
19
OstreamAppender::~OstreamAppender
()
20
{
21
}
22
23
bool
OstreamAppender::configureHook
()
24
{
25
// verify valid limits
26
int
m =
maxEventsPerCycle_prop
.
rvalue
();
27
if
((0 > m))
28
{
29
log(
Error
) <<
"Invalid maxEventsPerCycle value of "
30
<< m <<
". Value must be >= 0."
31
<< endlog();
32
return
false
;
33
}
34
maxEventsPerCycle
= m;
35
36
if
(!
appender
)
37
appender
=
new
log4cpp::OstreamAppender
(
getName
(), &std::cout);
38
39
return
configureLayout
();
40
}
41
42
void
OstreamAppender::updateHook
()
43
{
44
processEvents
(1);
45
}
46
47
void
OstreamAppender::cleanupHook
()
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
61
ORO_LIST_COMPONENT_TYPE
(
OCL::logging::OstreamAppender
);
OCL::logging::OstreamAppender::configureHook
virtual bool configureHook()
Create log4cpp appender.
Definition:
OstreamAppender.cpp:23
OCL::logging::OstreamAppender::maxEventsPerCycle_prop
RTT::Property< int > maxEventsPerCycle_prop
Definition:
OstreamAppender.hpp:27
OCL::logging::Appender::appender
log4cpp::Appender * appender
Appender created by derived class.
Definition:
Appender.hpp:52
OCL::logging::OstreamAppender::maxEventsPerCycle
int maxEventsPerCycle
Definition:
OstreamAppender.hpp:38
OCL::logging::OstreamAppender::updateHook
virtual void updateHook()
Process at most one (1) event.
Definition:
OstreamAppender.cpp:42
OstreamAppender.hh
OstreamAppender.hpp
RTT::Property::rvalue
const_reference_t rvalue() const
OCL::logging::OstreamAppender::cleanupHook
virtual void cleanupHook()
Destroy appender.
Definition:
OstreamAppender.cpp:47
OCL::logging::Appender
Definition:
Appender.hpp:16
OCL::logging::OstreamAppender::~OstreamAppender
virtual ~OstreamAppender()
Definition:
OstreamAppender.cpp:19
Component.hpp
OCL::logging::Appender::configureLayout
virtual bool configureLayout()
Definition:
Appender.cpp:29
RTT::PropertyBag::addProperty
Property< T > & addProperty(const std::string &name, T &attr)
OCL
Definition:
deployer-funcs.cpp:68
OCL::logging::Appender::processEvents
virtual void processEvents(int n)
Definition:
Appender.cpp:104
ORO_LIST_COMPONENT_TYPE
ORO_LIST_COMPONENT_TYPE(OCL::logging::OstreamAppender)
Error
Error
RTT::TaskContext::properties
PropertyBag * properties()
OCL::logging::OstreamAppender
Definition:
OstreamAppender.hpp:10
RTT
RTT::TaskContext::getName
virtual const std::string & getName() const
log4cpp::OstreamAppender
ocl
Author(s): OCL Development Team
autogenerated on Wed Jun 26 2019 19:26:27