1 #include "TRACE/trace.h"
2 #define TRACE_NAME "ECLTest"
4 #include "otsdaq-utilities/ECLWriter/ECLConnection.h"
6 #include <boost/program_options.hpp>
7 namespace bpo = boost::program_options;
9 int main(
int argc,
char* argv[])
11 std::ostringstream descstr;
13 <<
" --host <ECL host> --user <Username> --pwd <Password> [--title <Message "
15 bpo::options_description desc(descstr.str());
16 desc.add_options()(
"host,i", bpo::value<std::string>(),
"ECL Instance Address")(
17 "user,u", bpo::value<std::string>(),
"ECL Username")(
18 "pwd,p", bpo::value<std::string>(),
"ECL Password")(
19 "title,t", bpo::value<std::string>(),
"Message title")(
20 "msg,m", bpo::value<std::string>(),
"Log Message")(
"help,h",
21 "produce help message");
22 bpo::positional_options_description p;
24 bpo::variables_map vm;
27 bpo::store(bpo::command_line_parser(argc, argv).options(desc).positional(p).run(),
31 catch(bpo::error
const& e)
33 TLOG(TLVL_ERROR) <<
"Exception from command line processing in " << argv[0]
34 <<
": " << e.what() <<
"\n";
39 std::cout << desc << std::endl;
43 std::string ECLUser =
"", ECLPwd =
"", ECLHost =
"", title =
"ECL Test Message",
47 ECLUser = vm[
"user"].as<std::string>();
51 ECLPwd = vm[
"pwd"].as<std::string>();
55 ECLHost = vm[
"host"].as<std::string>();
59 title = vm[
"title"].as<std::string>();
63 message = vm[
"msg"].as<std::string>();
67 eclEntry.author(ECLUser);
68 eclEntry.category(
"TDAQ");
69 eclEntry.subject(title);
72 Form_t::field_sequence fields;
76 field =
Field_t(message,
"text");
77 fields.push_back(field);
84 if(!eclConn.Post(eclEntry))