Line data Source code
1 : /**
2 : * @file OpMonFacility.hpp
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 "opmonlib/OpMonFacility.hpp"
10 : #include "logging/Logging.hpp"
11 :
12 : using namespace dunedaq::opmonlib;
13 :
14 17 : std::shared_ptr<OpMonFacility> dunedaq::opmonlib::makeOpMonFacility(std::string const& facility, OptionalOrigin o) {
15 :
16 34 : TLOG() << "FACILITY = " << facility;
17 :
18 17 : const std::string hook = "://";
19 17 : auto sep = facility.find(hook);
20 17 : std::string scheme;
21 17 : if (sep == std::string::npos) { // simple path
22 2 : scheme = "stdout";
23 : } else { // with scheme
24 15 : scheme = facility.substr(0, sep);
25 : }
26 :
27 :
28 17 : std::string plugin_name = scheme + "OpMonFacility";
29 17 : static cet::BasicPluginFactory bpf("duneOpMonFacility", "make");
30 17 : std::shared_ptr<OpMonFacility> os_ptr;
31 :
32 17 : try {
33 17 : os_ptr = bpf.makePlugin<std::shared_ptr<OpMonFacility>>(plugin_name, facility, o);
34 3 : } catch (const ers::Issue& iexpt) {
35 2 : throw OpMonFacilityCreationFailed(ERS_HERE, plugin_name, iexpt);
36 3 : } catch (const cet::exception& cexpt) {
37 1 : throw OpMonFacilityCreationFailedWithCause(ERS_HERE, plugin_name, cexpt.what());
38 1 : } catch (...) { // NOLINT JCF Jan-27-2021 violates letter of the law but not the spirit
39 0 : throw OpMonFacilityCreationFailed(ERS_HERE, plugin_name);
40 0 : }
41 14 : return os_ptr;
42 26 : }
43 :
44 :
45 :
46 :
47 :
|