Apache Log4cxx  Version 1.3.0
Loading...
Searching...
No Matches
appenderskeleton.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _LOG4CXX_APPENDER_SKELETON_H
19#define _LOG4CXX_APPENDER_SKELETON_H
20
21#include <log4cxx/appender.h>
22#include <log4cxx/layout.h>
24#include <log4cxx/spi/filter.h>
27#include <log4cxx/level.h>
28
29namespace LOG4CXX_NS
30{
31
39 public virtual Appender,
40 public virtual helpers::Object
41{
42 protected:
43 LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(AppenderSkeletonPrivate, m_priv)
44 AppenderSkeleton(LOG4CXX_PRIVATE_PTR(AppenderSkeletonPrivate) priv);
45
51 virtual void append(const spi::LoggingEventPtr& event, LOG4CXX_NS::helpers::Pool& p) = 0;
52
53 void doAppendImpl(const spi::LoggingEventPtr& event, LOG4CXX_NS::helpers::Pool& pool);
54
55 public:
60 LOG4CXX_CAST_ENTRY(spi::OptionHandler)
62
65 virtual ~AppenderSkeleton();
66
71 void finalize();
72
78 void activateOptions(helpers::Pool& /* pool */) override {}
79
87 void setOption(const LogString& option, const LogString& value) override;
88
92 void addFilter(const spi::FilterPtr newFilter) override;
93
94 public:
98 void clearFilters() override;
99
105
109 spi::FilterPtr getFilter() const override;
110
117
121 LayoutPtr getLayout() const override;
122
123
127 LogString getName() const override;
128
133 const LevelPtr getThreshold() const;
134
140 bool isAsSevereAsThreshold(const LevelPtr& level) const;
141
142
148 void doAppend(const spi::LoggingEventPtr& event, helpers::Pool& pool) override;
149
154
159 void setLayout(const LayoutPtr layout1) override;
160
164 void setName(const LogString& name1) override;
165
166
175 void setThreshold(const LevelPtr& threshold);
176
177}; // class AppenderSkeleton
178} // namespace log4cxx
179
180#endif //_LOG4CXX_APPENDER_SKELETON_H
Implementation base class for all appenders.
Definition: appenderskeleton.h:41
LogString getName() const override
Returns the name of this Appender.
void setErrorHandler(const spi::ErrorHandlerPtr eh)
Set the ErrorHandler for this Appender.
spi::FilterPtr getFilter() const override
Returns the head Filter.
void doAppend(const spi::LoggingEventPtr &event, helpers::Pool &pool) override
This method performs threshold checks and invokes filters before delegating actual logging to the sub...
const spi::FilterPtr getFirstFilter() const
Return the first filter in the filter chain for this Appender.
LayoutPtr getLayout() const override
Returns the layout of this appender.
void setOption(const LogString &option, const LogString &value) override
Set option to value.
const LevelPtr getThreshold() const
Returns this appenders threshold level.
void setName(const LogString &name1) override
Set the name of this Appender.
void setLayout(const LayoutPtr layout1) override
Set the layout for this appender.
void setThreshold(const LevelPtr &threshold)
Set the threshold level.
void addFilter(const spi::FilterPtr newFilter) override
Add a filter to end of the filter list.
bool isAsSevereAsThreshold(const LevelPtr &level) const
Check whether the message level is below the appender's threshold.
void clearFilters() override
Clear the filters chain.
const spi::ErrorHandlerPtr getErrorHandler() const
Return the currently set spi::ErrorHandler for this Appender.
Implement this interface for your own strategies for outputting log statements.
Definition: appender.h:51
base class for java-like objects.
Definition: object.h:106
Definition: pool.h:33
#define LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(T, V)
Definition: log4cxx.h:85
#define LOG4CXX_EXPORT
Definition: log4cxx.h:101
#define LOG4CXX_NS
Definition: log4cxx.h:104
#define LOG4CXX_PRIVATE_PTR(T)
Definition: log4cxx.h:68
std::shared_ptr< ErrorHandler > ErrorHandlerPtr
Definition: appender.h:38
std::shared_ptr< Filter > FilterPtr
Definition: appender.h:35
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition: appender.h:32
std::basic_string< logchar > LogString
Definition: logstring.h:60
std::shared_ptr< Level > LevelPtr
Definition: optionconverter.h:28
std::shared_ptr< Layout > LayoutPtr
Definition: appender.h:42
#define LOG4CXX_CAST_ENTRY(Interface)
Definition: object.h:158
#define DECLARE_ABSTRACT_LOG4CXX_OBJECT(object)
Definition: object.h:39
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:152
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:146