1 | // |
2 | // NullChannel.h |
3 | // |
4 | // Library: Foundation |
5 | // Package: Logging |
6 | // Module: NullChannel |
7 | // |
8 | // Definition of the NullChannel class. |
9 | // |
10 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. |
11 | // and Contributors. |
12 | // |
13 | // SPDX-License-Identifier: BSL-1.0 |
14 | // |
15 | |
16 | |
17 | #ifndef Foundation_NullChannel_INCLUDED |
18 | #define Foundation_NullChannel_INCLUDED |
19 | |
20 | |
21 | #include "Poco/Foundation.h" |
22 | #include "Poco/Channel.h" |
23 | |
24 | |
25 | namespace Poco { |
26 | |
27 | |
28 | class Foundation_API NullChannel: public Channel |
29 | /// The NullChannel is the /dev/null of Channels. |
30 | /// |
31 | /// A NullChannel discards all information sent to it. |
32 | /// Furthermore, its setProperty() method ignores |
33 | /// all properties, so it the NullChannel has the |
34 | /// nice feature that it can stand in for any |
35 | /// other channel class in a logging configuration. |
36 | { |
37 | public: |
38 | typedef AutoPtr<NullChannel> Ptr; |
39 | |
40 | NullChannel(); |
41 | /// Creates the NullChannel. |
42 | |
43 | ~NullChannel(); |
44 | /// Destroys the NullChannel. |
45 | |
46 | void log(const Message& msg); |
47 | /// Does nothing. |
48 | |
49 | void setProperty(const std::string& name, const std::string& value); |
50 | /// Ignores both name and value. |
51 | }; |
52 | |
53 | |
54 | } // namespace Poco |
55 | |
56 | |
57 | #endif // Foundation_NullChannel_INCLUDED |
58 | |