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 # if MESSAGEFACILITY_HEX_VERSION >= 0x20002 // an indication of a switch from s48 to s50
61 std::ostringstream descstr;
63 fhicl::ParameterSet main_pset;
64 mf::StartMessageFacility( main_pset );
66 mf::StartMessageFacility(
67 mf::MessageFacilityService::SingleThread,
68 mf::MessageFacilityService::logArchive(filename));
71 fhicl::ParameterSet pset;
72 auto maker = cet::filepath_maker();
73 fhicl::make_ParameterSet(configFile, maker, pset);
78 std::cout <<
"Message Facility MsgServer is up and listening to configured Receivers" <<std::endl;
85 if (cmdline) std::cout <<
"> ";
86 getline(std::cin, cmd);
92 else if (cmdline && (cmd ==
"r" || cmd ==
"resume"))
96 else if (cmdline && (cmd ==
"q" || cmd ==
"quit"))
101 else if (cmdline && (cmd ==
"h" || cmd ==
"help"))
103 std::cout <<
"MessageFacility DDS server available commands:\n"
104 <<
" (h)elp display this help message\n"
105 <<
" (s)tat summary of received messages\n"
106 <<
" (r)esume resume to message listening mode\n"
108 <<
" (q)uit exit MessageFacility DDS server\n"
109 <<
" ... more interactive commands on the way.\n";
111 else if (cmdline && (cmd ==
"s" || cmd ==
"stat"))
113 std::cout <<
"Currently listening, " << z <<
" messages have been received." << std::endl;
117 std::cout <<
"Command " << cmd <<
" not found. "
118 <<
"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...