2 #define ML_DEBUG // always enable debug
4 #if MESSAGEFACILITY_HEX_VERSION >= 0x20002 // an indication of a switch from s48 to s50
5 # include "fhiclcpp/ParameterSet.h"
6 # include "fhiclcpp/make_ParameterSet.h"
14 #include "messagefacility/MessageLogger/MessageLogger.h"
19 # if MESSAGEFACILITY_HEX_VERSION >= 0x20002 // an indication of a switch from s48 to s50
20 mf::SetApplicationName(
"anotherLogger");
22 mf::SetModuleName(
"anotherLogger");
25 mf::LogWarning(
"warn1 | warn2") <<
"Followed by a WARNING message.";
26 mf::LogDebug(
"debug") <<
"The debug message in the other thread";
36 # if MESSAGEFACILITY_HEX_VERSION >= 0x20002 // an indication of a switch from s48 to s50
37 std::ostringstream ss;
38 std::ifstream logfhicl(
"MessageFacility.cfg");
39 if (logfhicl.is_open()) {
40 std::stringstream fhiclstream;
41 fhiclstream << logfhicl.rdbuf();
42 ss << fhiclstream.str();
44 fhicl::ParameterSet pset;
45 std::string pstr(ss.str());
46 fhicl::make_ParameterSet(pstr, pset);
47 mf::StartMessageFacility( pset );
49 mf::StartMessageFacility(
50 mf::MessageFacilityService::MultiThread,
51 mf::MessageFacilityService::ConfigurationFile(
52 "MessageFacility.cfg",
53 mf::MessageFacilityService::logCF(
"mylog")));
56 catch (std::exception& e)
58 std::cerr <<
"Catched\n" << e.what();
63 mf::SetApplicationName(
"mftest");
64 # if MESSAGEFACILITY_HEX_VERSION < 0x20002 // v2_00_02 is s50, pre v2_00_02 is s48
65 mf::SetModuleName(
"MFTest");
66 mf::SetContext(
"pre-event");
77 # if MESSAGEFACILITY_HEX_VERSION < 0x20002 // v2_00_02 is s50, pre v2_00_02 is s48
78 mf::SetContext(
"pro-event");
86 for (
int i = 0; i < 2; ++i)
90 sprintf(buf,
"mftest-%d", i);
91 mf::SetApplicationName(buf);
94 mf::LogError(
"catError") <<
"Error information. " << i;
95 mf::LogWarning(
"catWarning") <<
"Warning information. " << i;
96 mf::LogInfo(
"catInfo") <<
"Info information. " << i;
97 LOG_DEBUG(
"debug") <<
"DEBUG information. " << i;