1 /****************************************************************************\
2 * Copyright (C) 2018 Infineon Technologies & pmdtechnologies ag
4 * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
5 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
6 * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
9 \****************************************************************************/
13 #include <royale/IEvent.hpp>
15 namespace sample_utils
18 * This class reports on events from Royale. Depending on the event's severity, this class
19 * writes the description of the event to standard output or standard error. Information and
20 * warnings are written to standard output. Non-fatal errors and fatal errors are written to
23 class EventReporter : public royale::IEventListener
26 virtual ~EventReporter() = default;
31 virtual void onEvent (std::unique_ptr<royale::IEvent> &&event) override
33 royale::EventSeverity severity = event->severity();
37 case royale::EventSeverity::ROYALE_INFO:
38 case royale::EventSeverity::ROYALE_WARNING:
39 std::cout << event->describe() << std::endl;
41 case royale::EventSeverity::ROYALE_ERROR:
42 case royale::EventSeverity::ROYALE_FATAL:
43 std::cerr << event->describe() << std::endl;