Line data Source code
1 : /**
2 : * @file stdoutOpMonFacility.cpp
3 : *
4 : * This is part of the DUNE DAQ Application Framework, copyright 2020.
5 : * Licensing/copyright details are in the COPYING file that you should have
6 : * received with this code.
7 : */
8 :
9 : #include "logging/Logging.hpp"
10 : #include "opmonlib/JSonOpMonFacility.hpp"
11 :
12 : #include <google/protobuf/util/json_util.h>
13 :
14 : #include <iostream>
15 : #include <memory>
16 : #include <string>
17 :
18 : namespace dunedaq::opmonlib {
19 :
20 : class stdoutOpMonFacility : public JSonOpMonFacility
21 : {
22 : public:
23 2 : explicit stdoutOpMonFacility(std::string uri, OptionalOrigin)
24 2 : : JSonOpMonFacility(uri)
25 : {
26 2 : ;
27 2 : }
28 :
29 1 : void publish(opmon::OpMonEntry&& e) const override
30 : {
31 1 : std::string json;
32 1 : google::protobuf::util::MessageToJsonString(e, &json, get_json_options());
33 2 : TLOG() << "OpMon metric: " << json;
34 1 : }
35 : };
36 :
37 : } // namespace dunedaq::opmonlib
38 :
39 2 : DEFINE_DUNE_OPMON_FACILITY(dunedaq::opmonlib::stdoutOpMonFacility)
|