 |
Belle II Software
release-05-01-25
|
10 #include <framework/pcore/zmq/utils/ZMQLogger.h>
11 #include <boost/property_tree/json_parser.hpp>
19 std::stringstream buffer;
27 buffer <<
"\"" << keyValue.first <<
"\": ";
28 buffer << std::visit(
toJSON{}, keyValue.second);
30 buffer <<
"}" << std::endl;
46 auto current = std::chrono::system_clock::now();
47 auto displayTime = std::chrono::system_clock::to_time_t(current);
48 log(key, std::ctime(&displayTime));
53 return std::to_string(value);
58 return std::to_string(value);
63 return "\"" + boost::property_tree::json_parser::create_escapes(value) +
"\"";
78 throw std::domain_error(
"Can not increment a string type");
93 throw std::domain_error(
"Can not decrement a string type");
std::string operator()(long value)
just stringify longs
Visitor Helper for decrementing a numerical value.
void logTime(const std::string &key)
Store the current time as a string under the given key.
void operator()(long &value)
-1 for longs
void decrement(const std::string &key)
Decrement the value with the given key (only numerical values). If not present, set to -1.
void log(const std::string &key, const AClass &value)
Store a value under a certain key. Different types of values can be stored, namely long,...
void increment(const std::string &key)
Increment the value with the given key (only numerical values). If not present, set to 1.
Abstract base class for different kinds of events.
void operator()(long &value)
+1 for longs
Visitor Helper for converting a variant value into a JSON string.
Visitor Helper for incrementing a numerical value.
virtual std::string getMonitoringJSON() const
Convert the stored monitoring values to a JSON string ready for sending out via a message.
std::map< std::string, std::variant< long, double, std::string > > m_monitoring
Internal storage of all stored values.