Coverage Report

Created: 2026-07-30 07:12

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/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
461
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
5.07k
{
36
5.07k
  Pool p;
37
5.07k
  format(output, event, p);
38
5.07k
}
39
40
924
void Layout::appendHeader(LogString&, LOG4CXX_NS::helpers::Pool&) {}
41
42
void Layout::appendHeader(LogString& output)
43
924
{
44
924
  Pool p;
45
924
  appendHeader(output, p);
46
924
}
47
48
924
void Layout::appendFooter(LogString&, LOG4CXX_NS::helpers::Pool&) {}
49
50
void Layout::appendFooter(LogString& output)
51
924
{
52
924
  Pool p;
53
924
  appendFooter(output, p);
54
924
}
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
461
{
83
461
  auto exampleEvent = std::make_shared<spi::LoggingEvent>
84
461
    ( LOG4CXX_STR("example.logger")
85
461
    , Level::getDebug()
86
461
    , LOG4CXX_LOCATION
87
461
    , LogString()
88
461
    );
89
461
  LogString text;
90
461
  format(text, exampleEvent);
91
461
  return text.size();
92
461
}
93
94
#if 15 < LOG4CXX_ABI_VERSION
95
void Layout::activateOptions( LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS )
96
{
97
}
98
#endif