Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
messagefacility
messagefacility
test
Integration
WildcardDebug_t.cc
Go to the documentation of this file.
1
//#define NDEBUG
2
#define MF_DEBUG // always enable debug
3
4
#include "boost/filesystem.hpp"
5
#include "boost/program_options.hpp"
6
#include "
cetlib/filepath_maker.h
"
7
#include "
fhiclcpp/ParameterSet.h
"
8
#include "
fhiclcpp/types/detail/validationException.h
"
9
#include "
messagefacility/MessageLogger/MessageLogger.h
"
10
#include "
messagefacility/Utilities/exception.h
"
11
12
#include <iostream>
13
14
namespace
bpo = boost::program_options;
15
16
using namespace
std
;
17
18
int
19
main
(
int
argc,
char
*
argv
[])
20
{
21
ostringstream descstr;
22
descstr <<
"\nELdestinationTester is a sample program that can be used\n"
23
<<
"to test how messages are logged using different destinations\n"
24
<<
"and configurations. This can be particularly helpful for\n"
25
<<
"users who wish to supply their own plugin destinations.\n\n"
26
<<
"The configuration file should look like\n"
27
<<
"\n"
28
<<
" message: {\n"
29
<<
" destinations: {\n"
30
<<
" dest1: {\n"
31
<<
" ...\n"
32
<<
" }\n"
33
<<
" ...\n"
34
<<
" }\n"
35
<<
" }\n\n"
36
<<
"Usage: "
<< boost::filesystem::path(argv[0]).filename().native()
37
<<
" -c <config-file> \n\n"
38
<<
"Allowed options"
;
39
bpo::options_description
desc
{descstr.str()};
40
desc
.add_options()(
"config,c"
, bpo::value<string>(),
"Configuration file."
)(
41
"help,h"
,
"produce help message"
);
42
bpo::variables_map vm;
43
try
{
44
bpo::store(bpo::parse_command_line(argc, argv,
desc
), vm);
45
bpo::notify(vm);
46
}
47
catch
(
bpo::error
const
&
e
) {
48
cerr <<
"Exception from command line processing in "
<< argv[0] <<
": "
49
<< e.what() <<
"\n"
;
50
return
2;
51
}
52
if
(vm.count(
"help"
)) {
53
cout <<
desc
<<
endl
;
54
return
1;
55
}
56
if
(!vm.count(
"config"
)) {
57
cerr <<
"ERROR: No configuration specified ( -c <config_file> )"
<<
endl
;
58
return
3;
59
}
60
string
const
config_string = vm[
"config"
].as<
string
>();
61
cet::filepath_lookup_nonabsolute
filepath
{
"FHICL_FILE_PATH"
};
62
fhicl::ParameterSet
main_pset;
63
try
{
64
main_pset =
fhicl::ParameterSet::make
(config_string,
filepath
);
65
}
66
catch
(
cet::exception
const
& e) {
67
cerr <<
"ERROR: Failed to create a parameter set from an input "
68
<<
"configuration string with exception:\n"
69
<< e.what() <<
"\n\n"
70
<<
"Input configuration string was:\n\n"
71
<< config_string <<
"\n"
;
72
return
7003;
73
}
74
try
{
75
mf::StartMessageFacility
(main_pset.
get
<
fhicl::ParameterSet
>(
"message"
),
76
string
(
"MessageFacility"
));
77
}
78
catch
(
mf::Exception
const
& e) {
79
cerr << e.what() <<
endl
;
80
return
4;
81
}
82
catch
(
fhicl::detail::validationException
const
& e) {
83
cerr << e.
what
() <<
endl
;
84
return
6;
85
}
86
catch
(
cet::exception
const
& e) {
87
cerr << e.what() <<
endl
;
88
return
7;
89
}
90
catch
(...) {
91
cerr <<
"Caught unknown exception from mf::StartMessageFacility"
<<
endl
;
92
return
5;
93
}
94
MF_LOG_DEBUG
(
"WildcardDebug_t"
) <<
"Testing"
;
95
}
fhicl::ParameterSet::make
static ParameterSet make(intermediate_table const &tbl)
Definition:
ParameterSet.cc:68
test_wireplots.desc
desc
Definition:
test_wireplots.py:10
error
error
Definition:
include.cc:26
std
STL namespace.
freeze_graph.argv
argv
Definition:
freeze_graph.py:218
MessageLogger.h
ParameterSet.h
mf::Exception
cet::coded_exception< errors::error, detail::translate > Exception
Definition:
exception.h:16
mf::StartMessageFacility
void StartMessageFacility(fhicl::ParameterSet const &pset, string const &applicationName)
Definition:
MessageLogger.cc:460
e
const double e
Definition:
gUpMuFluxGen.cxx:165
fhicl::detail::validationException
Definition:
validationException.h:10
fhicl::ParameterSet::get
T get(std::string const &key) const
Definition:
ParameterSet.h:271
filepath_maker.h
main
int main(int argc, char *argv[])
Definition:
WildcardDebug_t.cc:19
train.filepath
string filepath
Definition:
train.py:371
fhicl::detail::validationException::what
char const * what() const noexcept override
Definition:
validationException.h:14
validationException.h
exception.h
MF_LOG_DEBUG
#define MF_LOG_DEBUG(id)
Definition:
MessageLogger.h:268
cet::filepath_lookup_nonabsolute
Definition:
filepath_maker.h:65
fhicl::exception
cet::coded_exception< error, detail::translate > exception
Definition:
exception.h:33
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11