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[]) {
20 std::string configFile;
23 po::options_description cmdopt(
"Allowed options");
24 cmdopt.add_options()(
"help,h",
"display help message")(
"config,c",
25 po::value<std::string>(&configFile)->default_value(
""),
26 "Specify the FHiCL configuration file to use")(
27 "filename,f", po::value<std::string>(&filename)->default_value(
"msg_archive"),
28 "specify the message archive file name");
30 po::options_description desc;
34 po::store(po::command_line_parser(argc, argv).options(desc).run(), vm);
37 if (vm.count(
"help")) {
38 std::cout <<
"Usage: msglogger [options] <message text>\n";
42 }
catch (std::exception& e) {
43 std::cerr <<
"error: " << e.what() <<
"\n";
46 std::cerr <<
"Exception of unknown type!\n";
51 std::ostringstream descstr;
53 fhicl::ParameterSet main_pset;
54 mf::StartMessageFacility(main_pset);
56 fhicl::ParameterSet pset;
57 auto maker = cet::filepath_maker();
58 fhicl::make_ParameterSet(configFile, maker, pset);
62 std::cout <<
"Message Facility MsgServer is up and listening to configured Receivers" << std::endl;
68 if (cmdline) std::cout <<
"> ";
69 getline(std::cin, cmd);
73 }
else if (cmdline && (cmd ==
"r" || cmd ==
"resume")) {
76 }
else if (cmdline && (cmd ==
"q" || cmd ==
"quit")) {
79 }
else if (cmdline && (cmd ==
"h" || cmd ==
"help")) {
80 std::cout <<
"MessageFacility DDS server available commands:\n"
81 <<
" (h)elp display this help message\n"
82 <<
" (s)tat summary of received messages\n"
83 <<
" (r)esume resume to message listening mode\n"
85 <<
" (q)uit exit MessageFacility DDS server\n"
86 <<
" ... more interactive commands on the way.\n";
87 }
else if (cmdline && (cmd ==
"s" || cmd ==
"stat")) {
88 std::cout <<
"Currently listening, " << z <<
" messages have been received." << std::endl;
90 std::cout <<
"Command " << cmd <<
" not found. "
91 <<
"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...