1 #include "messagefacility/MessageLogger/MessageLogger.h"
2 #include "messagefacility/Utilities/ErrorObj.h"
4 #include <boost/program_options.hpp>
8 #include "fhiclcpp/make_ParameterSet.h"
9 #include "mfextensions/Receivers/ReceiverManager.hh"
11 namespace po = boost::program_options;
16 int main(
int argc,
char* argv[])
20 std::string configFile;
24 po::options_description cmdopt(
"Allowed options");
25 cmdopt.add_options()(
"help,h",
"display help message")(
"config,c",
26 po::value<std::string>(&configFile)->default_value(
""),
27 "Specify the FHiCL configuration file to use")(
28 "filename,f", po::value<std::string>(&filename)->default_value(
"msg_archive"),
29 "specify the message archive file name");
31 po::options_description desc;
35 po::store(po::command_line_parser(argc, argv).options(desc).run(), vm);
38 if (vm.count(
"help") != 0u)
40 std::cout <<
"Usage: msglogger [options] <message text>\n";
45 catch (std::exception& e)
47 std::cerr <<
"error: " << e.what() <<
"\n";
52 std::cerr <<
"Exception of unknown type!\n";
57 std::ostringstream descstr;
59 fhicl::ParameterSet main_pset;
60 mf::StartMessageFacility(main_pset);
62 fhicl::ParameterSet pset;
63 auto maker = cet::filepath_maker();
64 fhicl::make_ParameterSet(configFile, maker, pset);
68 std::cout <<
"Message Facility MsgServer is up and listening to configured Receivers" << std::endl;
79 getline(std::cin, cmd);
85 else if (cmdline && (cmd ==
"r" || cmd ==
"resume"))
90 else if (cmdline && (cmd ==
"q" || cmd ==
"quit"))
95 else if (cmdline && (cmd ==
"h" || cmd ==
"help"))
97 std::cout <<
"MessageFacility DDS server available commands:\n"
98 <<
" (h)elp display this help message\n"
99 <<
" (s)tat summary of received messages\n"
100 <<
" (r)esume resume to message listening mode\n"
102 <<
" (q)uit exit MessageFacility DDS server\n"
103 <<
" ... more interactive commands on the way.\n";
105 else if (cmdline && (cmd ==
"s" || cmd ==
"stat"))
107 std::cout <<
"Currently listening, " << z <<
" messages have been received." << std::endl;
111 std::cout <<
"Command " << cmd <<
" not found. "
112 <<
"Type \"help\" or \"h\" for a list of available commands.\n";
The ReceiverManager loads one or more receiver plugins and displays messages received by those plugin...