1 | // |
2 | // EventChannel.h |
3 | // |
4 | // Library: Foundation |
5 | // Package: Logging |
6 | // Module: EventChannel |
7 | // |
8 | // Definition of the EventChannel class. |
9 | // |
10 | // Copyright (c) 2015, Applied Informatics Software Engineering GmbH. |
11 | // and Contributors. |
12 | // |
13 | // SPDX-License-Identifier: BSL-1.0 |
14 | // |
15 | |
16 | |
17 | #ifndef Foundation_EventChannel_INCLUDED |
18 | #define Foundation_EventChannel_INCLUDED |
19 | |
20 | |
21 | #include "Poco/Foundation.h" |
22 | #include "Poco/Channel.h" |
23 | #include "Poco/Message.h" |
24 | #include "Poco/BasicEvent.h" |
25 | |
26 | |
27 | namespace Poco { |
28 | |
29 | |
30 | class Foundation_API EventChannel: public Channel |
31 | /// The EventChannel fires the messageLogged event for every log message |
32 | /// received. This can be used to hook custom log message processing into |
33 | /// the logging framework. |
34 | { |
35 | public: |
36 | Poco::BasicEvent<const Message> messageLogged; |
37 | /// Fired when a message is logged by calling the log() method. |
38 | |
39 | EventChannel(); |
40 | /// Creates the EventChannel. |
41 | |
42 | void log(const Message& msg); |
43 | /// Fires the messageLogged event. |
44 | |
45 | protected: |
46 | ~EventChannel(); |
47 | /// Destroys the EventChannel. |
48 | }; |
49 | |
50 | |
51 | } // namespace Poco |
52 | |
53 | |
54 | #endif // Foundation_EventChannel_INCLUDED |
55 | |