15 const std::unique_lock<std::mutex> lk(this->log_mutex);
16 const auto time_point = std::chrono::system_clock::now();
17 const std::time_t now = std::chrono::system_clock::to_time_t(time_point);
19 this->ss << std::put_time(std::localtime(&now),
"%F %T");
20 this->ss <<
" ] (EVENT FIRED)\t";
21 this->ss <<
" TYPE -- " <<
event->getName();
24 this->ss <<
"\t VALUE -- ";
25 this->ss << std::any_cast<int64_t>(event->
getParam(
"period"));
34 this->ss <<
"\t SOURCE -- ";
36 << std::any_cast<RT::Thread*>(event->
getParam(
"thread"))->getName();
42 this->ss <<
"\t SOURCE -- ";
44 << std::any_cast<RT::Device*>(event->
getParam(
"device"))->getName();
48 auto connection = std::any_cast<RT::block_connection_t>(
50 this->ss <<
"\t CONNECTION -- {";
51 this->ss <<
"source: " << connection.src->getName();
53 << (connection.src_port_type ==
IO::OUTPUT ?
"Output" 55 this->ss <<
" port: " << connection.src_port;
56 this->ss <<
"} <==> {";
57 this->ss <<
"destination: " << connection.dest->getName();
58 this->ss <<
" port: " << connection.dest_port <<
"}";
62 this->ss <<
"\t SOURCE -- ";
63 this->ss << std::any_cast<std::string>(event->
getParam(
"pluginName"));
66 this->ss <<
"\t SOURCE -- ";
67 this->ss << std::any_cast<Widgets::Plugin*>(
72 this->ss <<
"\t SOURCE -- ";
73 this->ss << std::any_cast<Widgets::Component*>(
76 this->ss <<
" TYPE -- ";
78 std::any_cast<Widgets::Variable::variable_t>(
82 this->ss <<
"\t SOURCE -- ";
83 this->ss << std::any_cast<Widgets::Component*>(
86 this->ss <<
" TYPE -- ";
88 std::any_cast<RT::State::state_t>(event->
getParam(
"state")));
94 std::cout << this->ss.str();
96 }
catch (std::bad_any_cast&) {
107 const std::unique_lock<std::mutex> lk(this->log_mutex);
108 const auto time_point = std::chrono::system_clock::now();
109 const std::time_t now = std::chrono::system_clock::to_time_t(time_point);
111 this->ss << std::put_time(std::localtime(&now),
"%F %T");
112 this->ss <<
" ] (TELEMITRY)\t";
113 this->ss <<
" TYPE -- ";
114 switch (response.
type) {
116 this->ss <<
"Period Updated";
119 this->ss <<
"System Threadlist Updated";
122 this->ss <<
" System Devicelist Updated";
125 this->ss <<
"NO-OP Acknowledged";
128 this->ss <<
"Real-Time System Shutdown";
131 this->ss <<
"Widget Parameter Updated";
134 this->ss <<
"IO Link Updated";
137 this->ss <<
"Widget State Updated";
140 this->ss <<
"Real-Time System Error";
143 this->ss <<
"NO TELEMITRY";
149 std::cout << this->ss.str();
152 ERROR_MSG(
"Something went wrong while logging telemitry from RT system");
Event::Type getType() const
std::any getParam(const std::string ¶m_name) const
void log(Event::Object *event)
void ERROR_MSG(const std::string &errmsg, Args... args)
@ RT_WIDGET_PARAMETER_CHANGE_EVENT
@ RT_DEVICE_UNPAUSE_EVENT
@ RT_THREAD_UNPAUSE_EVENT
@ RT_WIDGET_STATE_CHANGE_EVENT
constexpr response_t RT_WIDGET_PARAM_UPDATE
constexpr response_t RT_DEVICE_LIST_UPDATE
constexpr response_t RT_NOOP
constexpr response_t NO_TELEMITRY
constexpr response_t IO_LINK_UPDATED
constexpr response_t RT_PERIOD_UPDATE
constexpr response_t RT_ERROR
constexpr response_t RT_THREAD_LIST_UPDATE
constexpr response_t RT_WIDGET_STATE_UPDATE
constexpr response_t RT_SHUTDOWN