9 #include <fmt/format.h>
10 #include <log4cplus/loggingmacros.h>
14 inline constexpr
bool always_false_v =
false;
20 : m_logger(std::move(logger)) {
27 char const* preamble =
"[DAQ EVENT]";
30 using T = std::decay_t<decltype(ev)>;
31 if constexpr (std::is_same_v<T, UserActionEvent>) {
32 auto const& ev = std::get<UserActionEvent>(event);
33 LOG4CPLUS_INFO(m_logger,
34 fmt::format(
"{} id='{}', type=UserActionEvent, description='{}'",
39 }
else if constexpr (std::is_same_v<T, ActionEvent>) {
40 auto const& ev = std::get<ActionEvent>(event);
41 LOG4CPLUS_INFO(m_logger,
42 fmt::format(
"{} id='{}', type=ActionEvent, description='{}'",
47 }
else if constexpr (std::is_same_v<T, GenericEvent>) {
48 auto const& ev = std::get<GenericEvent>(event);
49 LOG4CPLUS_INFO(m_logger,
50 fmt::format(
"{} id='{}', type=GenericEvent, description='{}'",
55 }
else if constexpr (std::is_same_v<T, ErrorEvent>) {
56 auto const& ev = std::get<ErrorEvent>(event);
57 LOG4CPLUS_INFO(m_logger,
58 fmt::format(
"{} id='{}', type=ErrorEvent, origin='{}', "
66 static_assert(always_false_v<T>,
"non-exhaustive visitor!");
EventLogObserverLogger(log4cplus::Logger logger)
void operator()(EventLog::EventType const &event) noexcept
Observer callback that immediately logs the event.
Contains declaration for EventLogObserverLogger.
std::variant< ActionEvent, UserActionEvent, GenericEvent, ErrorEvent > EventType