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 1 : void publish(opmon::OpMonEntry && e) const override {
27 1 : std::string json;
28 1 : google::protobuf::util::MessageToJsonString( e, & json, get_json_options() );
29 2 : TLOG() << "OpMon metric: " << json ;
30 1 : }
31 :
32 : };
33 :
34 : } // namespace dunedaq::opmonlib
35 :
36 2 : DEFINE_DUNE_OPMON_FACILITY(dunedaq::opmonlib::stdoutOpMonFacility)
|