Apache Log4cxx  Version 1.8.0
Loading...
Searching...
No Matches
layout.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_LAYOUT_H
19#define _LOG4CXX_LAYOUT_H
20
24
25
26namespace LOG4CXX_NS
27{
31class LOG4CXX_EXPORT Layout
32#if LOG4CXX_ABI_VERSION <= 15
33 : public virtual spi::OptionHandler
34 , public virtual helpers::Object
35#else
36 : public spi::OptionHandler
37#endif
38{
39 public:
45
46 virtual ~Layout();
47
51#if LOG4CXX_ABI_VERSION <= 15
52 void format(LogString& output, const spi::LoggingEventPtr& event) const;
57 virtual void format(LogString& output,
58 const spi::LoggingEventPtr& event, LOG4CXX_NS::helpers::Pool& pool) const = 0;
59#define LOG4CXX_FORMAT_LAYOUT_FORMAL_PARAMETERS LogString& output, const spi::LoggingEventPtr& event, helpers::Pool& p
60#else
61 virtual void format(LogString& output, const spi::LoggingEventPtr& event) const = 0;
62#define LOG4CXX_FORMAT_LAYOUT_FORMAL_PARAMETERS LogString& output, const spi::LoggingEventPtr& event
66 [[deprecated("Use format() without a Pool parameter instead")]]
67 void format(LogString& output, const spi::LoggingEventPtr& event, helpers::Pool& p) const;
68#endif
69
74 virtual LogString getContentType() const;
75
80#if LOG4CXX_ABI_VERSION <= 15
81 void appendHeader(LogString& output);
86 virtual void appendHeader(LogString& output, LOG4CXX_NS::helpers::Pool& p);
87#define LOG4CXX_APPEND_HEADER_FORMAL_PARAMETERS LogString& output, LOG4CXX_NS::helpers::Pool& p
88#else
89 virtual void appendHeader(LogString& output);
90#define LOG4CXX_APPEND_HEADER_FORMAL_PARAMETERS LogString& output
94 [[deprecated("Use appendHeader() without a Pool parameter instead")]]
95 void appendHeader(LogString& output, helpers::Pool& p);
96#endif
97
102#if LOG4CXX_ABI_VERSION <= 15
103 void appendFooter(LogString& output);
108 virtual void appendFooter(LogString& output, LOG4CXX_NS::helpers::Pool& p);
109#define LOG4CXX_APPEND_FOOTER_FORMAL_PARAMETERS LogString& output, LOG4CXX_NS::helpers::Pool& p
110#else
111 virtual void appendFooter(LogString& output);
112#define LOG4CXX_APPEND_FOOTER_FORMAL_PARAMETERS LogString& output
116 [[deprecated("Use appendFooter() without a Pool parameter instead")]]
117 void appendFooter(LogString& output, helpers::Pool& p);
118#endif
119
129 virtual bool ignoresThrowable() const = 0;
130
131#if 15 < LOG4CXX_ABI_VERSION
139#endif
140 protected:
145};
147}
148
149#endif // _LOG4CXX_LAYOUT_H
Extend this abstract class to create your own log layout format.
Definition layout.h:38
void appendFooter(LogString &output)
Append the footer for the layout format.
virtual void appendHeader(LogString &output, log4cxx::helpers::Pool &p)
virtual void appendFooter(LogString &output, log4cxx::helpers::Pool &p)
virtual bool ignoresThrowable() const =0
If the layout handles the throwable object contained within LoggingEvent, then the layout should retu...
virtual void format(LogString &output, const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &pool) const =0
void format(LogString &output, const spi::LoggingEventPtr &event) const
Implement this method to create your own layout format.
virtual LogString getContentType() const
Returns the content type output by this layout.
void appendHeader(LogString &output)
Append the header for the layout format.
size_t getFormattedEventCharacterCount() const
The expected length of a formatted event excluding the message text.
base class for java-like objects.
Definition object.h:102
A string based interface to configure package components.
Definition optionhandler.h:35
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition appender.h:32
std::basic_string< logchar > LogString
Definition logstring.h:60
LOG4CXX_PTR_DEF(Appender)
#define LOG4CXX_CAST_ENTRY(Interface)
Definition object.h:154
#define DECLARE_ABSTRACT_LOG4CXX_OBJECT(object)
Definition object.h:37
#define END_LOG4CXX_CAST_MAP()
Definition object.h:148
#define BEGIN_LOG4CXX_CAST_MAP()
Definition object.h:142
#define LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS
Activate the options that were previously set with calls to option setters.
Definition optionhandler.h:53