Coverage Report

Created: 2025-07-01 06:08

/src/logging-log4cxx/src/main/include/log4cxx/simplelayout.h
Line
Count
Source (jump to first uncovered line)
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_SIMPLE_LAYOUT_H
19
#define _LOG4CXX_SIMPLE_LAYOUT_H
20
21
#include <log4cxx/layout.h>
22
23
namespace LOG4CXX_NS
24
{
25
/**
26
SimpleLayout consists of the level of the log statement,
27
followed by " - " and then the log message itself. For example,
28
29
<pre>
30
        DEBUG - Hello world
31
</pre>
32
33
<p>
34
35
<p>PatternLayout offers a much more powerful alternative.
36
*/
37
class LOG4CXX_EXPORT SimpleLayout : public Layout
38
{
39
  public:
40
    DECLARE_LOG4CXX_OBJECT(SimpleLayout)
41
0
    BEGIN_LOG4CXX_CAST_MAP()
42
0
    LOG4CXX_CAST_ENTRY(SimpleLayout)
43
0
    LOG4CXX_CAST_ENTRY_CHAIN(Layout)
44
0
    END_LOG4CXX_CAST_MAP()
45
46
    /**
47
    Returns the log statement in a format consisting of the
48
    <code>level</code>, followed by " - " and then the
49
    <code>message</code>. For example, <pre> INFO - "A message"
50
    </pre>
51
    */
52
    void format(LogString& output,
53
      const spi::LoggingEventPtr& event,
54
      helpers::Pool& pool) const override;
55
56
    /**
57
    The SimpleLayout does not handle the throwable contained within
58
    {@link spi::LoggingEvent LoggingEvents}. Thus, it returns
59
    <code>true</code>.
60
    */
61
    bool ignoresThrowable() const override
62
0
    {
63
0
      return true;
64
0
    }
65
66
    /**
67
    \copybrief spi::OptionHandler::activateOptions()
68
69
    No action is performed in this implementation.
70
    */
71
0
    void activateOptions(helpers::Pool& /* p */) override {}
72
73
    /**
74
    \copybrief spi::OptionHandler::setOption()
75
76
    Supported options | Supported values | Default value
77
    -------------- | ---------------- | ---------------
78
    - | - | -
79
    */
80
    void setOption(const LogString& /* option */,
81
0
      const LogString& /* value */) override {}
82
};
83
LOG4CXX_PTR_DEF(SimpleLayout);
84
}  // namespace log4cxx
85
86
#endif //_LOG4CXX_SIMPLE_LAYOUT_H