3 #if MESSAGEFACILITY_HEX_VERSION < 0x20300
4 #define ML_DEBUG // always enable debug
14 #include "fhiclcpp/ParameterSet.h"
15 #include "fhiclcpp/make_ParameterSet.h"
17 #include "messagefacility/MessageLogger/MessageLogger.h"
22 mf::SetApplicationName(
"anotherLogger");
24 mf::LogWarning(
"warn1 | warn2") <<
"Followed by a WARNING message.";
25 mf::LogDebug(
"debug") <<
"The debug message in the other thread";
35 std::ostringstream ss;
36 std::ifstream logfhicl(
"MessageFacility.cfg");
37 if (logfhicl.is_open())
39 std::stringstream fhiclstream;
40 fhiclstream << logfhicl.rdbuf();
41 ss << fhiclstream.str();
43 fhicl::ParameterSet pset;
44 std::string pstr(ss.str());
45 fhicl::make_ParameterSet(pstr, pset);
46 mf::StartMessageFacility(pset);
48 catch (std::exception& e)
50 std::cerr <<
"Catched\n"
56 mf::SetApplicationName(
"mftest");
72 for (
int i = 0; i < 2; ++i)
76 sprintf(buf,
"mftest-%d", i);
77 mf::SetApplicationName(buf);
80 mf::LogError(
"catError") <<
"Error information. " << i;
81 mf::LogWarning(
"catWarning") <<
"Warning information. " << i;
82 mf::LogInfo(
"catInfo") <<
"Info information. " << i;
83 #if MESSAGEFACILITY_HEX_VERSION < 0x20300
84 LOG_DEBUG(
"debug") <<
"DEBUG information. " << i;
86 MF_LOG_DEBUG(
"debug") <<
"DEBUG information. " << i;