EventChannel.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. #ifndef Foundation_EventChannel_INCLUDED
  16. #define Foundation_EventChannel_INCLUDED
  17. #include "Poco/Foundation.h"
  18. #include "Poco/Channel.h"
  19. #include "Poco/Message.h"
  20. #include "Poco/BasicEvent.h"
  21. namespace Poco {
  22. class Foundation_API EventChannel: public Channel
  23. /// The EventChannel fires the messageLogged event for every log message
  24. /// received. This can be used to hook custom log message processing into
  25. /// the logging framework.
  26. {
  27. public:
  28. Poco::BasicEvent<const Message> messageLogged;
  29. /// Fired when a message is logged by calling the log() method.
  30. EventChannel();
  31. /// Creates the EventChannel.
  32. void log(const Message& msg);
  33. /// Fires the messageLogged event.
  34. protected:
  35. ~EventChannel();
  36. /// Destroys the EventChannel.
  37. };
  38. } // namespace Poco
  39. #endif // Foundation_EventChannel_INCLUDED