Apache Log4cxx  Version 2.0.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
31class LOG4CXX_EXPORT WriterAppender : public AppenderSkeleton
32{
33 protected:
34 struct WriterAppenderPriv;
35 public:
41
42
46 protected:
51 WriterAppender(const LayoutPtr& layout, const helpers::WriterPtr& writer = helpers::WriterPtr());
55 WriterAppender(std::unique_ptr<WriterAppenderPriv> priv);
56
57 public:
59
65 void activateOptions( ) override;
66
81 void setImmediateFlush(bool value);
85 bool getImmediateFlush() const;
86
99 void append( const spi::LoggingEventPtr& event ) override;
100
101
102 protected:
109 virtual bool checkEntryConditions() const;
110
111 public:
123 void setEncoding(const LogString& value);
124
134 void setOption(const LogString& option, const LogString& value) override;
135
136 protected:
140 virtual void subAppend( const spi::LoggingEventPtr& event );
141
142
143 private:
144 //
145 // prevent copy and assignment
147 WriterAppender& operator=(const WriterAppender&);
148};
149
151
152} //namespace log4cxx
153
154#endif //_LOG4CXX_WRITER_APPENDER_H
AppenderSkeleton(LOG4CXX_PRIVATE_PTR(AppenderSkeletonPrivate) priv)
An abstract base for an appender that writes to a character stream.
Definition writerappender.h:32
void activateOptions() override
Derived appenders should override this method if option structure requires it.
LogString getEncoding() const
The current encoding value.
void setOption(const LogString &option, const LogString &value) override
Override this method to set option to value.
virtual void subAppend(const spi::LoggingEventPtr &event)
Format event as a message and write it to the character stream.
void setImmediateFlush(bool value)
If the ImmediateFlush option is set to true, the appender will flush at the end of each write.
void append(const spi::LoggingEventPtr &event) override
This method is called by the AppenderSkeleton::doAppend method.
bool getImmediateFlush() const
Returns value of the ImmediateFlush option.
virtual bool checkEntryConditions() const
This method determines if there is a sense in attempting to append.
void setEncoding(const LogString &value)
Set the encoding to value.
WriterAppender()
An uninitialised Appender.
Definition propertysetter.h:27
Definition appender.h:30
std::basic_string< logchar > LogString
Definition logstring.h:51
std::shared_ptr< Layout > LayoutPtr
Definition appender.h:42
LOG4CXX_PTR_DEF(Appender)
#define LOG4CXX_CAST_ENTRY(Interface)
Definition object.h:153
#define DECLARE_ABSTRACT_LOG4CXX_OBJECT(object)
Definition object.h:37
#define END_LOG4CXX_CAST_MAP()
Definition object.h:147
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition object.h:159
#define BEGIN_LOG4CXX_CAST_MAP()
Definition object.h:141