1 #include "messagefacility/MessageLogger/MessageLogger.h"
2 #include "messagefacility/Utilities/ErrorObj.h"
4 #include <boost/program_options.hpp>
5 #include <boost/bind.hpp>
9 #include "mfextensions/Binaries/ReceiverManager.hh"
10 #include "fhiclcpp/make_ParameterSet.h"
12 namespace po = boost::program_options;
17 int main(
int argc,
char* argv[])
21 std::string configFile;
25 po::options_description cmdopt(
"Allowed options");
27 (
"help,h",
"display help message")
28 (
"config,c", po::value<std::string>(&configFile)->default_value(
""),
"Specify the FHiCL configuration file to use")
30 po::value<std::string>(&filename)->default_value(
"msg_archive"),
31 "specify the message archive file name");
33 po::options_description desc;
37 po::store(po::command_line_parser(argc, argv).options(desc).run(), vm);
42 std::cout <<
"Usage: msglogger [options] <message text>\n";
47 catch (std::exception& e)
49 std::cerr <<
"error: " << e.what() <<
"\n";
54 std::cerr <<
"Exception of unknown type!\n";
60 std::ostringstream descstr;
62 fhicl::ParameterSet main_pset;
63 mf::StartMessageFacility(main_pset);
65 fhicl::ParameterSet pset;
66 auto maker = cet::filepath_maker();
67 fhicl::make_ParameterSet(configFile, maker, pset);
72 std::cout <<
"Message Facility MsgServer is up and listening to configured Receivers" << std::endl;
79 if (cmdline) std::cout <<
"> ";
80 getline(std::cin, cmd);
86 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...