/src/logging-log4cxx/src/main/cpp/levelpatternconverter.cpp
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 | | #include <log4cxx/logstring.h> |
19 | | #include <log4cxx/pattern/levelpatternconverter.h> |
20 | | #include <log4cxx/spi/loggingevent.h> |
21 | | #include <log4cxx/spi/location/locationinfo.h> |
22 | | #include <log4cxx/level.h> |
23 | | |
24 | | |
25 | | using namespace LOG4CXX_NS; |
26 | | using namespace LOG4CXX_NS::pattern; |
27 | | using namespace LOG4CXX_NS::spi; |
28 | | using namespace LOG4CXX_NS::helpers; |
29 | | |
30 | | IMPLEMENT_LOG4CXX_OBJECT(LevelPatternConverter) |
31 | | |
32 | | LevelPatternConverter::LevelPatternConverter() : |
33 | 18 | LoggingEventPatternConverter(LOG4CXX_STR("Level"), |
34 | 18 | LOG4CXX_STR("level")) |
35 | 18 | { |
36 | 18 | } Unexecuted instantiation: log4cxx::pattern::LevelPatternConverter::LevelPatternConverter() log4cxx::pattern::LevelPatternConverter::LevelPatternConverter() Line | Count | Source | 33 | 18 | LoggingEventPatternConverter(LOG4CXX_STR("Level"), | 34 | 18 | LOG4CXX_STR("level")) | 35 | 18 | { | 36 | 18 | } |
|
37 | | |
38 | | PatternConverterPtr LevelPatternConverter::newInstance( |
39 | | const std::vector<LogString>& /* options */) |
40 | 2.54k | { |
41 | 2.54k | static WideLife<PatternConverterPtr> def = std::make_shared<LevelPatternConverter>(); |
42 | 2.54k | return def; |
43 | 2.54k | } log4cxx::pattern::LevelPatternConverter::newInstance(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) Line | Count | Source | 40 | 2.53k | { | 41 | 2.53k | static WideLife<PatternConverterPtr> def = std::make_shared<LevelPatternConverter>(); | 42 | 2.53k | return def; | 43 | 2.53k | } |
log4cxx::pattern::LevelPatternConverter::newInstance(std::__1::vector<std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >, std::__1::allocator<std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > > > const&) Line | Count | Source | 40 | 1 | { | 41 | 1 | static WideLife<PatternConverterPtr> def = std::make_shared<LevelPatternConverter>(); | 42 | 1 | return def; | 43 | 1 | } |
|
44 | | |
45 | | void LevelPatternConverter::format( |
46 | | const LoggingEventPtr& event, |
47 | | LogString& toAppendTo, |
48 | | LOG4CXX_NS::helpers::Pool& /* p */) const |
49 | 463k | { |
50 | 463k | toAppendTo.append(event->getLevel()->toString()); |
51 | 463k | } log4cxx::pattern::LevelPatternConverter::format(std::__1::shared_ptr<log4cxx::spi::LoggingEvent> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, log4cxx::helpers::Pool&) const Line | Count | Source | 49 | 44.8k | { | 50 | 44.8k | toAppendTo.append(event->getLevel()->toString()); | 51 | 44.8k | } |
log4cxx::pattern::LevelPatternConverter::format(std::__1::shared_ptr<log4cxx::spi::LoggingEvent> const&, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&, log4cxx::helpers::Pool&) const Line | Count | Source | 49 | 418k | { | 50 | 418k | toAppendTo.append(event->getLevel()->toString()); | 51 | 418k | } |
|
52 | | |
53 | | |
54 | | /** |
55 | | * {@inheritDoc} |
56 | | */ |
57 | | LogString LevelPatternConverter::getStyleClass(const ObjectPtr& obj) const |
58 | 0 | { |
59 | 0 | LoggingEventPtr e = LOG4CXX_NS::cast<LoggingEvent>(obj); |
60 | |
|
61 | 0 | if (e != NULL) |
62 | 0 | { |
63 | 0 | int lint = e->getLevel()->toInt(); |
64 | |
|
65 | 0 | switch (lint) |
66 | 0 | { |
67 | 0 | case Level::TRACE_INT: |
68 | 0 | return LOG4CXX_STR("level trace"); |
69 | | |
70 | 0 | case Level::DEBUG_INT: |
71 | 0 | return LOG4CXX_STR("level debug"); |
72 | | |
73 | 0 | case Level::INFO_INT: |
74 | 0 | return LOG4CXX_STR("level info"); |
75 | | |
76 | 0 | case Level::WARN_INT: |
77 | 0 | return LOG4CXX_STR("level warn"); |
78 | | |
79 | 0 | case Level::ERROR_INT: |
80 | 0 | return LOG4CXX_STR("level error"); |
81 | | |
82 | 0 | case Level::FATAL_INT: |
83 | 0 | return LOG4CXX_STR("level fatal"); |
84 | | |
85 | 0 | default: |
86 | 0 | return LogString(LOG4CXX_STR("level ")) + e->getLevel()->toString(); |
87 | 0 | } |
88 | 0 | } |
89 | | |
90 | 0 | return LOG4CXX_STR("level"); |
91 | 0 | } Unexecuted instantiation: log4cxx::pattern::LevelPatternConverter::getStyleClass(std::__1::shared_ptr<log4cxx::helpers::Object> const&) const Unexecuted instantiation: log4cxx::pattern::LevelPatternConverter::getStyleClass(std::__1::shared_ptr<log4cxx::helpers::Object> const&) const |