| 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 | typedef AutoPtr<EventChannel> Ptr; | 
|---|
| 37 |  | 
|---|
| 38 | Poco::BasicEvent<const Message> messageLogged; | 
|---|
| 39 | /// Fired when a message is logged by calling the log() method. | 
|---|
| 40 |  | 
|---|
| 41 | EventChannel(); | 
|---|
| 42 | /// Creates the EventChannel. | 
|---|
| 43 |  | 
|---|
| 44 | void log(const Message& msg); | 
|---|
| 45 | /// Fires the messageLogged event. | 
|---|
| 46 |  | 
|---|
| 47 | protected: | 
|---|
| 48 | ~EventChannel(); | 
|---|
| 49 | /// Destroys the EventChannel. | 
|---|
| 50 | }; | 
|---|
| 51 |  | 
|---|
| 52 |  | 
|---|
| 53 | } // namespace Poco | 
|---|
| 54 |  | 
|---|
| 55 |  | 
|---|
| 56 | #endif // Foundation_EventChannel_INCLUDED | 
|---|
| 57 |  | 
|---|