/src/logging-log4cxx/src/main/cpp/sizebasedtriggeringpolicy.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/rolling/sizebasedtriggeringpolicy.h> |
19 | | #include <log4cxx/helpers/stringhelper.h> |
20 | | #include <log4cxx/helpers/optionconverter.h> |
21 | | |
22 | | using namespace LOG4CXX_NS; |
23 | | using namespace LOG4CXX_NS::rolling; |
24 | | using namespace LOG4CXX_NS::helpers; |
25 | | |
26 | | IMPLEMENT_LOG4CXX_OBJECT(SizeBasedTriggeringPolicy) |
27 | | |
28 | | SizeBasedTriggeringPolicy::SizeBasedTriggeringPolicy() |
29 | 0 | : maxFileSize(10 * 1024 * 1024) |
30 | 0 | { |
31 | 0 | } Unexecuted instantiation: log4cxx::rolling::SizeBasedTriggeringPolicy::SizeBasedTriggeringPolicy() Unexecuted instantiation: log4cxx::rolling::SizeBasedTriggeringPolicy::SizeBasedTriggeringPolicy() |
32 | | |
33 | | bool SizeBasedTriggeringPolicy::isTriggeringEvent(Appender* /* appender */, |
34 | | const LOG4CXX_NS::spi::LoggingEventPtr& /* event */, |
35 | | const LogString& /* file */, |
36 | | size_t fileLength) |
37 | 0 | { |
38 | 0 | return (fileLength >= maxFileSize); |
39 | 0 | } Unexecuted instantiation: log4cxx::rolling::SizeBasedTriggeringPolicy::isTriggeringEvent(log4cxx::Appender*, std::__1::shared_ptr<log4cxx::spi::LoggingEvent> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long) Unexecuted instantiation: log4cxx::rolling::SizeBasedTriggeringPolicy::isTriggeringEvent(log4cxx::Appender*, 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> > const&, unsigned long) |
40 | | |
41 | | size_t SizeBasedTriggeringPolicy::getMaxFileSize() |
42 | 0 | { |
43 | 0 | return maxFileSize; |
44 | 0 | } |
45 | | |
46 | | void SizeBasedTriggeringPolicy::setMaxFileSize(size_t l) |
47 | 0 | { |
48 | 0 | maxFileSize = l; |
49 | 0 | } |
50 | | |
51 | | void SizeBasedTriggeringPolicy::activateOptions(Pool& /* p */) |
52 | 0 | { |
53 | 0 | } |
54 | | |
55 | | void SizeBasedTriggeringPolicy::setOption(const LogString& option, const LogString& value) |
56 | 0 | { |
57 | 0 | if (StringHelper::equalsIgnoreCase(option, |
58 | 0 | LOG4CXX_STR("MAXFILESIZE"), |
59 | 0 | LOG4CXX_STR("maxfilesize"))) |
60 | 0 | { |
61 | 0 | maxFileSize = OptionConverter::toFileSize(value, 10 * 1024 * 1024); |
62 | 0 | } |
63 | 0 | } Unexecuted instantiation: log4cxx::rolling::SizeBasedTriggeringPolicy::setOption(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: log4cxx::rolling::SizeBasedTriggeringPolicy::setOption(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&) |