Apache log4cxx  Version 0.12.1
appender.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_H
19 #define _LOG4CXX_APPENDER_H
20 
21 #if defined(_MSC_VER)
22  #pragma warning ( push )
23  #pragma warning ( disable: 4231 4251 4275 4786 )
24 #endif
25 
26 
28 #include <log4cxx/helpers/object.h>
29 #include <vector>
30 
31 
32 namespace log4cxx
33 {
34 // Forward declarations
35 namespace spi
36 {
37 class LoggingEvent;
38 typedef std::shared_ptr<LoggingEvent> LoggingEventPtr;
39 
40 class Filter;
41 typedef std::shared_ptr<Filter> FilterPtr;
42 
43 class ErrorHandler;
44 typedef std::shared_ptr<ErrorHandler> ErrorHandlerPtr;
45 }
46 
47 class Layout;
48 typedef std::shared_ptr<Layout> LayoutPtr;
49 
50 
55 class LOG4CXX_EXPORT Appender :
56  public virtual spi::OptionHandler
57 {
58  public:
60 
61  virtual ~Appender() {}
62 
63  void asdf();
64 
68  virtual void addFilter(const spi::FilterPtr& newFilter) = 0;
69 
76  virtual spi::FilterPtr getFilter() const = 0;
77 
81  virtual void clearFilters() = 0;
82 
88  virtual void close() = 0;
89 
95  virtual void doAppend(const spi::LoggingEventPtr& event,
96  log4cxx::helpers::Pool& pool) = 0;
97 
98 
103  virtual LogString getName() const = 0;
104 
105 
109  virtual void setLayout(const LayoutPtr& layout) = 0;
110 
114  virtual LayoutPtr getLayout() const = 0;
115 
116 
121  virtual void setName(const LogString& name) = 0;
122 
137  virtual bool requiresLayout() const = 0;
138 };
139 
142 
143 }
144 
145 #if defined(_MSC_VER)
146  #pragma warning ( pop )
147 #endif
148 
149 #endif //_LOG4CXX_APPENDER_H
Implement this interface for your own strategies for outputting log statements.
Definition: appender.h:57
virtual void doAppend(const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &pool)=0
Log in Appender specific way.
virtual LogString getName() const =0
Get the name of this appender.
virtual spi::FilterPtr getFilter() const =0
Returns the head Filter.
virtual bool requiresLayout() const =0
Configurators call this method to determine if the appender requires a layout.
virtual void close()=0
Release any resources allocated within the appender such as file handles, network connections,...
virtual void addFilter(const spi::FilterPtr &newFilter)=0
Add a filter to the end of the filter list.
virtual void clearFilters()=0
Clear the list of filters by removing all the filters in it.
virtual LayoutPtr getLayout() const =0
Returns this appenders layout.
virtual void setLayout(const LayoutPtr &layout)=0
Set the Layout for this appender.
virtual void setName(const LogString &name)=0
Set the name of this appender.
Extend this abstract class to create your own log layout format.
Definition: layout.h:40
Definition: pool.h:33
Appenders may delegate their error handling to ErrorHandlers.
Definition: errorhandler.h:65
Users should extend this class to implement customized logging event filtering.
Definition: filter.h:70
The internal representation of logging events.
Definition: loggingevent.h:55
A string based interface to configure package components.
Definition: optionhandler.h:35
std::shared_ptr< Filter > FilterPtr
Definition: appender.h:40
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition: appender.h:37
std::shared_ptr< ErrorHandler > ErrorHandlerPtr
Definition: appender.h:43
Definition: appender.h:33
LOG4CXX_LIST_DEF(AppenderList, AppenderPtr)
std::basic_string< logchar > LogString
Definition: logstring.h:66
std::shared_ptr< Layout > LayoutPtr
Definition: appender.h:47
LOG4CXX_PTR_DEF(Appender)
std::shared_ptr< Appender > AppenderPtr
Definition: basicconfigurator.h:28
#define DECLARE_ABSTRACT_LOG4CXX_OBJECT(object)
Definition: object.h:26