Apache Log4cxx  Version 1.2.0
Loading...
Searching...
No Matches
writerappender.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_WRITER_APPENDER_H
19#define _LOG4CXX_WRITER_APPENDER_H
20
23#include <atomic>
24
25namespace LOG4CXX_NS
26{
27
28namespace helpers
29{
30class Transcoder;
31}
32
36class LOG4CXX_EXPORT WriterAppender : public AppenderSkeleton
37{
38 protected:
39 struct WriterAppenderPriv;
40 public:
46
47
50 protected:
52 LOG4CXX_NS::helpers::WriterPtr& writer);
53 WriterAppender(const LayoutPtr& layout);
54 WriterAppender(std::unique_ptr<WriterAppenderPriv> priv);
55
56 public:
58
63 void activateOptions(helpers::Pool& pool) override;
64
79 void setImmediateFlush(bool value);
83 bool getImmediateFlush() const;
84
97 void append(const spi::LoggingEventPtr& event, helpers::Pool& p) override;
98
99
100 protected:
107 virtual bool checkEntryConditions() const;
108
109
110 public:
117 void close() override;
118
119 protected:
123 void closeWriter();
124
131 virtual helpers::WriterPtr createWriter(helpers::OutputStreamPtr& os);
132
133 public:
139 LogString getEncoding() const;
145 void setEncoding(const LogString& value);
146
156 void setOption(const LogString& option, const LogString& value) override;
157
168 void setWriter(const LOG4CXX_NS::helpers::WriterPtr& writer);
169
170 const LOG4CXX_NS::helpers::WriterPtr getWriter() const;
171
172 bool requiresLayout() const override;
173
174 protected:
178 virtual void subAppend(const spi::LoggingEventPtr& event, LOG4CXX_NS::helpers::Pool& p);
179
180
184 virtual void writeFooter(LOG4CXX_NS::helpers::Pool& p);
185
189 virtual void writeHeader(LOG4CXX_NS::helpers::Pool& p);
190
194 void setWriterInternal(const LOG4CXX_NS::helpers::WriterPtr& writer);
195
196 private:
197 //
198 // prevent copy and assignment
200 WriterAppender& operator=(const WriterAppender&);
201};
202
203LOG4CXX_PTR_DEF(WriterAppender);
204
205} //namespace log4cxx
206
207#endif //_LOG4CXX_WRITER_APPENDER_H
Implementation base class for all appenders.
Definition: appenderskeleton.h:41
WriterAppender appends log events to a standard output stream.
Definition: writerappender.h:37
std::basic_string< logchar > LogString
Definition: logstring.h:60
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 LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition: object.h:164
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:146