1 #include "messagefacility/MessageLogger/MessageLogger.h"
2 #include "messagefacility/Utilities/ErrorObj.h"
4 #include <boost/bind.hpp>
5 #include <boost/program_options.hpp>
9 #include "fhiclcpp/make_ParameterSet.h"
10 #include "mfextensions/Receivers/ReceiverManager.hh"
12 namespace po = boost::program_options;
17 int main(
int argc,
char* argv[])
21 std::string configFile;
25 po::options_description cmdopt(
"Allowed options");
26 cmdopt.add_options()(
"help,h",
"display help message")(
"config,c",
27 po::value<std::string>(&configFile)->default_value(
""),
28 "Specify the FHiCL configuration file to use")(
29 "filename,f", po::value<std::string>(&filename)->default_value(
"msg_archive"),
30 "specify the message archive file name");
32 po::options_description desc;
36 po::store(po::command_line_parser(argc, argv).options(desc).run(), vm);
39 if (vm.count(
"help") != 0u)
41 std::cout <<
"Usage: msglogger [options] <message text>\n";
46 catch (std::exception& e)
48 std::cerr <<
"error: " << e.what() <<
"\n";
53 std::cerr <<
"Exception of unknown type!\n";
58 std::ostringstream descstr;
60 fhicl::ParameterSet main_pset;
61 mf::StartMessageFacility(main_pset);
63 fhicl::ParameterSet pset;
64 auto maker = cet::filepath_maker();
65 fhicl::make_ParameterSet(configFile, maker, pset);
69 std::cout <<
"Message Facility MsgServer is up and listening to configured Receivers" << std::endl;
80 getline(std::cin, cmd);
86 else if (cmdline && (cmd ==
"r" || cmd ==
"resume"))
91 else if (cmdline && (cmd ==
"q" || cmd ==
"quit"))
96 else if (cmdline && (cmd ==
"h" || cmd ==
"help"))
98 std::cout <<
"MessageFacility DDS server available commands:\n"
99 <<
" (h)elp display this help message\n"
100 <<
" (s)tat summary of received messages\n"
101 <<
" (r)esume resume to message listening mode\n"
103 <<
" (q)uit exit MessageFacility DDS server\n"
104 <<
" ... more interactive commands on the way.\n";
106 else if (cmdline && (cmd ==
"s" || cmd ==
"stat"))
108 std::cout <<
"Currently listening, " << z <<
" messages have been received." << std::endl;
112 std::cout <<
"Command " << cmd <<
" not found. "
113 <<
"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...