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_FILTER_DENY_ALL_FILTER_H
|
---|
19 | #define _LOG4CXX_FILTER_DENY_ALL_FILTER_H
|
---|
20 |
|
---|
21 | #if defined(_MSC_VER)
|
---|
22 | #pragma warning ( push )
|
---|
23 | #pragma warning ( disable: 4231 4251 4275 4786 )
|
---|
24 | #endif
|
---|
25 |
|
---|
26 |
|
---|
27 | #include <log4cxx/spi/filter.h>
|
---|
28 |
|
---|
29 | namespace log4cxx
|
---|
30 | {
|
---|
31 | namespace filter
|
---|
32 | {
|
---|
33 | /**
|
---|
34 | This filter drops all logging events.
|
---|
35 | <p>You can add this filter to the end of a filter chain to
|
---|
36 | switch from the default "accept all unless instructed otherwise"
|
---|
37 | filtering behaviour to a "deny all unless instructed otherwise"
|
---|
38 | behaviour.
|
---|
39 | */
|
---|
40 |
|
---|
41 | class LOG4CXX_EXPORT DenyAllFilter : public spi::Filter
|
---|
42 | {
|
---|
43 | public:
|
---|
44 | DenyAllFilter() : spi::Filter() {
|
---|
45 | }
|
---|
46 |
|
---|
47 | typedef spi::Filter BASE_CLASS;
|
---|
48 | DECLARE_LOG4CXX_OBJECT(DenyAllFilter)
|
---|
49 | BEGIN_LOG4CXX_CAST_MAP()
|
---|
50 | LOG4CXX_CAST_ENTRY(DenyAllFilter)
|
---|
51 | LOG4CXX_CAST_ENTRY_CHAIN(BASE_CLASS)
|
---|
52 | END_LOG4CXX_CAST_MAP()
|
---|
53 |
|
---|
54 | /**
|
---|
55 | Always returns the integer constant {@link spi::Filter#DENY DENY}
|
---|
56 | regardless of the {@link spi::LoggingEvent LoggingEvent} parameter.
|
---|
57 | @param event The LoggingEvent to filter.
|
---|
58 | @return Always returns {@link spi::Filter#DENY DENY}.
|
---|
59 | */
|
---|
60 | FilterDecision decide(const spi::LoggingEventPtr& /* event */) const
|
---|
61 | { return spi::Filter::DENY; }
|
---|
62 | }; // class DenyAllFilter
|
---|
63 |
|
---|
64 | LOG4CXX_PTR_DEF(DenyAllFilter);
|
---|
65 | } // namespace filter
|
---|
66 | } // namespace log4cxx
|
---|
67 |
|
---|
68 | #if defined(_MSC_VER)
|
---|
69 | #pragma warning ( pop )
|
---|
70 | #endif
|
---|
71 |
|
---|
72 |
|
---|
73 | #endif // _LOG4CXX_FILTER_DENY_ALL_FILTER_H
|
---|