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/Binaries/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);
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;
76 if (cmdline) std::cout <<
"> ";
77 getline(std::cin, cmd);
83 else if (cmdline && (cmd ==
"r" || cmd ==
"resume"))
88 else if (cmdline && (cmd ==
"q" || cmd ==
"quit"))
93 else if (cmdline && (cmd ==
"h" || cmd ==
"help"))
95 std::cout <<
"MessageFacility DDS server available commands:\n"
96 <<
" (h)elp display this help message\n"
97 <<
" (s)tat summary of received messages\n"
98 <<
" (r)esume resume to message listening mode\n"
100 <<
" (q)uit exit MessageFacility DDS server\n"
101 <<
" ... more interactive commands on the way.\n";
103 else if (cmdline && (cmd ==
"s" || cmd ==
"stat"))
105 std::cout <<
"Currently listening, " << z <<
" messages have been received." << std::endl;
109 std::cout <<
"Command " << cmd <<
" not found. "
110 <<
"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...