/src/logging-log4cxx/src/main/cpp/layout.cpp
Line | Count | Source |
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 | | #include <log4cxx/logstring.h> |
18 | | #include <log4cxx/layout.h> |
19 | | |
20 | | using namespace LOG4CXX_NS; |
21 | | using namespace LOG4CXX_NS::helpers; |
22 | | |
23 | | IMPLEMENT_LOG4CXX_OBJECT(Layout) |
24 | | |
25 | | |
26 | 9.11k | Layout::~Layout() {} |
27 | | |
28 | | LogString Layout::getContentType() const |
29 | 0 | { |
30 | 0 | return LOG4CXX_STR("text/plain"); |
31 | 0 | } |
32 | | |
33 | | #if LOG4CXX_ABI_VERSION <= 15 |
34 | | void Layout::format(LogString& output, const spi::LoggingEventPtr& event) const |
35 | 17.9k | { |
36 | 17.9k | Pool p; |
37 | 17.9k | format(output, event, p); |
38 | 17.9k | } log4cxx::Layout::format(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::shared_ptr<log4cxx::spi::LoggingEvent> const&) const Line | Count | Source | 35 | 5.07k | { | 36 | 5.07k | Pool p; | 37 | 5.07k | format(output, event, p); | 38 | 5.07k | } |
log4cxx::Layout::format(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&, std::__1::shared_ptr<log4cxx::spi::LoggingEvent> const&) const Line | Count | Source | 35 | 12.8k | { | 36 | 12.8k | Pool p; | 37 | 12.8k | format(output, event, p); | 38 | 12.8k | } |
|
39 | | |
40 | 2.71k | void Layout::appendHeader(LogString&, LOG4CXX_NS::helpers::Pool&) {}log4cxx::Layout::appendHeader(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, log4cxx::helpers::Pool&) Line | Count | Source | 40 | 924 | void Layout::appendHeader(LogString&, LOG4CXX_NS::helpers::Pool&) {} |
log4cxx::Layout::appendHeader(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&, log4cxx::helpers::Pool&) Line | Count | Source | 40 | 1.78k | void Layout::appendHeader(LogString&, LOG4CXX_NS::helpers::Pool&) {} |
|
41 | | |
42 | | void Layout::appendHeader(LogString& output) |
43 | 2.71k | { |
44 | 2.71k | Pool p; |
45 | 2.71k | appendHeader(output, p); |
46 | 2.71k | } log4cxx::Layout::appendHeader(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) Line | Count | Source | 43 | 924 | { | 44 | 924 | Pool p; | 45 | 924 | appendHeader(output, p); | 46 | 924 | } |
log4cxx::Layout::appendHeader(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&) Line | Count | Source | 43 | 1.78k | { | 44 | 1.78k | Pool p; | 45 | 1.78k | appendHeader(output, p); | 46 | 1.78k | } |
|
47 | | |
48 | 2.71k | void Layout::appendFooter(LogString&, LOG4CXX_NS::helpers::Pool&) {}log4cxx::Layout::appendFooter(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, log4cxx::helpers::Pool&) Line | Count | Source | 48 | 924 | void Layout::appendFooter(LogString&, LOG4CXX_NS::helpers::Pool&) {} |
log4cxx::Layout::appendFooter(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&, log4cxx::helpers::Pool&) Line | Count | Source | 48 | 1.78k | void Layout::appendFooter(LogString&, LOG4CXX_NS::helpers::Pool&) {} |
|
49 | | |
50 | | void Layout::appendFooter(LogString& output) |
51 | 2.71k | { |
52 | 2.71k | Pool p; |
53 | 2.71k | appendFooter(output, p); |
54 | 2.71k | } log4cxx::Layout::appendFooter(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) Line | Count | Source | 51 | 924 | { | 52 | 924 | Pool p; | 53 | 924 | appendFooter(output, p); | 54 | 924 | } |
log4cxx::Layout::appendFooter(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&) Line | Count | Source | 51 | 1.78k | { | 52 | 1.78k | Pool p; | 53 | 1.78k | appendFooter(output, p); | 54 | 1.78k | } |
|
55 | | #else |
56 | | void Layout::format(LogString& output, const spi::LoggingEventPtr& event, helpers::Pool&) const |
57 | | { |
58 | | format(output, event); |
59 | | } |
60 | | |
61 | | void Layout::appendHeader(LogString& output, helpers::Pool&) |
62 | | { |
63 | | appendHeader(output); |
64 | | } |
65 | | void Layout::appendHeader(LogString& output) |
66 | | { |
67 | | } |
68 | | |
69 | | void Layout::appendFooter(LogString& output, helpers::Pool&) |
70 | | { |
71 | | appendFooter(output); |
72 | | } |
73 | | void Layout::appendFooter(LogString& output) |
74 | | { |
75 | | } |
76 | | #endif |
77 | | |
78 | | /** |
79 | | * The expected length of a formatted event excluding the message text |
80 | | */ |
81 | | size_t Layout::getFormattedEventCharacterCount() const |
82 | 4.42k | { |
83 | 4.42k | auto exampleEvent = std::make_shared<spi::LoggingEvent> |
84 | 4.42k | ( LOG4CXX_STR("example.logger") |
85 | 4.42k | , Level::getDebug() |
86 | 4.42k | , LOG4CXX_LOCATION |
87 | 4.42k | , LogString() |
88 | 4.42k | ); |
89 | 4.42k | LogString text; |
90 | 4.42k | format(text, exampleEvent); |
91 | 4.42k | return text.size(); |
92 | 4.42k | } |
93 | | |
94 | | #if 15 < LOG4CXX_ABI_VERSION |
95 | | void Layout::activateOptions( LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) |
96 | | { |
97 | | } |
98 | | #endif |