/src/logging-log4cxx/src/main/cpp/rolloverdescription.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/rolling/rolloverdescription.h> |
20 | | |
21 | | using namespace LOG4CXX_NS; |
22 | | using namespace LOG4CXX_NS::rolling; |
23 | | using namespace LOG4CXX_NS::helpers; |
24 | | |
25 | | IMPLEMENT_LOG4CXX_OBJECT(RolloverDescription) |
26 | | |
27 | | struct RolloverDescription::RolloverDescriptionPrivate{ |
28 | 0 | RolloverDescriptionPrivate(){} |
29 | | |
30 | | RolloverDescriptionPrivate( |
31 | | const LogString& activeFileName1, |
32 | | const bool append1, |
33 | | const ActionPtr& synchronous1, |
34 | | const ActionPtr& asynchronous1) |
35 | 1.24k | : activeFileName(activeFileName1), |
36 | 1.24k | append(append1), |
37 | 1.24k | synchronous(synchronous1), |
38 | 1.24k | asynchronous(asynchronous1) |
39 | 1.24k | {} |
40 | | |
41 | | /** |
42 | | * Active log file name after rollover. |
43 | | */ |
44 | | LogString activeFileName; |
45 | | |
46 | | /** |
47 | | * Should active file be opened for appending. |
48 | | */ |
49 | | bool append; |
50 | | |
51 | | /** |
52 | | * Action to be completed after close of current active log file |
53 | | * before returning control to caller. |
54 | | */ |
55 | | ActionPtr synchronous; |
56 | | |
57 | | /** |
58 | | * Action to be completed after close of current active log file |
59 | | * and before next rollover attempt, may be executed asynchronously. |
60 | | */ |
61 | | ActionPtr asynchronous; |
62 | | }; |
63 | | |
64 | | |
65 | | RolloverDescription::RolloverDescription() : |
66 | 0 | m_priv(std::make_unique<RolloverDescriptionPrivate>()) |
67 | 0 | { |
68 | 0 | } |
69 | | |
70 | | RolloverDescription::RolloverDescription( |
71 | | const LogString& activeFileName1, |
72 | | const bool append1, |
73 | | const ActionPtr& synchronous1, |
74 | | const ActionPtr& asynchronous1) |
75 | 1.24k | : m_priv(std::make_unique<RolloverDescriptionPrivate>(activeFileName1, append1, synchronous1, asynchronous1)) |
76 | 1.24k | { |
77 | 1.24k | } |
78 | | |
79 | 1.24k | RolloverDescription::~RolloverDescription(){} |
80 | | |
81 | | LogString RolloverDescription::getActiveFileName() const |
82 | 1.25k | { |
83 | 1.25k | return m_priv->activeFileName; |
84 | 1.25k | } |
85 | | |
86 | | bool RolloverDescription::getAppend() const |
87 | 1.24k | { |
88 | 1.24k | return m_priv->append; |
89 | 1.24k | } |
90 | | |
91 | | ActionPtr RolloverDescription::getSynchronous() const |
92 | 1.25k | { |
93 | 1.25k | return m_priv->synchronous; |
94 | 1.25k | } |
95 | | |
96 | | /** |
97 | | * Action to be completed after close of current active log file |
98 | | * and before next rollover attempt, may be executed asynchronously. |
99 | | * |
100 | | * @return action, may be null. |
101 | | */ |
102 | | ActionPtr RolloverDescription::getAsynchronous() const |
103 | 1.24k | { |
104 | 1.24k | return m_priv->asynchronous; |
105 | 1.24k | } |