Coverage Report

Created: 2026-12-01 07:12

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/logging-log4cxx/src/main/include/log4cxx/pattern/loggingeventpatternconverter.h
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
18
#ifndef _LOG4CXX_PATTERN_LOGGING_EVENT_PATTERN_CONVERTER_H
19
#define _LOG4CXX_PATTERN_LOGGING_EVENT_PATTERN_CONVERTER_H
20
21
#include <log4cxx/pattern/patternconverter.h>
22
#include <log4cxx/spi/loggingevent.h>
23
24
namespace LOG4CXX_NS
25
{
26
namespace helpers { class Pool; }
27
28
namespace pattern
29
{
30
/**
31
* LoggingEventPatternConverter is a base class for pattern converters
32
* that can format information from instances of LoggingEvent.
33
*
34
*
35
*
36
*
37
*/
38
class LOG4CXX_EXPORT LoggingEventPatternConverter : public PatternConverter
39
{
40
  protected:
41
    /**
42
     * Constructs an instance of LoggingEventPatternConverter.
43
     * @param name name of converter.
44
     * @param style CSS style for output.
45
     */
46
    LoggingEventPatternConverter(
47
      const LogString& name, const LogString& style);
48
49
    LoggingEventPatternConverter(std::unique_ptr<PatternConverterPrivate> priv);
50
51
  public:
52
    DECLARE_LOG4CXX_PATTERN(LoggingEventPatternConverter)
53
8.94M
    BEGIN_LOG4CXX_CAST_MAP()
54
8.94M
    LOG4CXX_CAST_ENTRY(LoggingEventPatternConverter)
55
240k
    LOG4CXX_CAST_ENTRY_CHAIN(PatternConverter)
56
240k
    END_LOG4CXX_CAST_MAP()
57
58
    using PatternConverter::format;
59
    /**
60
     * Formats an event into a string buffer.
61
     * @param event holds the attributes, may not be null.
62
     * @param toAppendTo string buffer to which the formatted event will be appended.  May not be null.
63
     */
64
    virtual void format(const spi::LoggingEventPtr& event, LogString& toAppendTo) const = 0;
65
    /**
66
    @deprecated The \c pool parameter is not used and will be removed in a future version.
67
    */
68
    [[deprecated("Use format() without a Pool parameter instead")]]
69
    void format(const spi::LoggingEventPtr& event, LogString& toAppendTo, helpers::Pool& p) const;
70
71
    void format( const helpers::ObjectPtr& obj, LogString& toAppendTo ) const override;
72
73
    /**
74
     * Normally pattern converters are not meant to handle Exceptions although
75
     * few pattern converters might.
76
     *
77
     * By examining the return values for this method, the containing layout will
78
     * determine whether it handles throwables or not.
79
80
     * @return true if this PatternConverter handles throwables
81
     */
82
    virtual bool handlesThrowable() const;
83
};
84
85
LOG4CXX_PTR_DEF(LoggingEventPatternConverter);
86
87
}
88
}
89
90
#endif