Apache log4cxx  Version 0.11.0
appender.h
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 
27 #include <log4cxx/spi/optionhandler.h>
28 #include <log4cxx/helpers/objectptr.h>
29 #include <log4cxx/helpers/object.h>
30 #include <vector>
31 
32 
33 namespace log4cxx
34 {
35 // Forward declarations
36 namespace spi
37 {
38 class LoggingEvent;
39 typedef helpers::ObjectPtrT<LoggingEvent> LoggingEventPtr;
40 
41 class Filter;
42 typedef helpers::ObjectPtrT<Filter> FilterPtr;
43 
44 class ErrorHandler;
45 typedef log4cxx::helpers::ObjectPtrT<ErrorHandler> ErrorHandlerPtr;
46 }
47 
48 class Layout;
49 typedef log4cxx::helpers::ObjectPtrT<Layout> LayoutPtr;
50 
51 
56 class LOG4CXX_EXPORT Appender :
57  public virtual spi::OptionHandler
58 {
59  public:
60  DECLARE_ABSTRACT_LOG4CXX_OBJECT(Appender)
61 
62  virtual ~Appender() {}
63 
67  virtual void addFilter(const spi::FilterPtr& newFilter) = 0;
68 
75  virtual spi::FilterPtr getFilter() const = 0;
76 
80  virtual void clearFilters() = 0;
81 
87  virtual void close() = 0;
88 
94  virtual void doAppend(const spi::LoggingEventPtr& event,
95  log4cxx::helpers::Pool& pool) = 0;
96 
97 
102  virtual LogString getName() const = 0;
103 
104 
108  virtual void setLayout(const LayoutPtr& layout) = 0;
109 
113  virtual LayoutPtr getLayout() const = 0;
114 
115 
120  virtual void setName(const LogString& name) = 0;
121 
136  virtual bool requiresLayout() const = 0;
137 };
138 
139 LOG4CXX_PTR_DEF(Appender);
140 LOG4CXX_LIST_DEF(AppenderList, AppenderPtr);
141 
142 }
143 
144 #if defined(_MSC_VER)
145  #pragma warning ( pop )
146 #endif
147 
148 #endif //_LOG4CXX_APPENDER_H
Implement this interface for your own strategies for outputting log statements.
Definition: appender.h:56
Definition: pool.h:32
A string based interface to configure package components.
Definition: optionhandler.h:35
Definition: appender.h:33