2 #define ML_DEBUG // always enable debug
4 # include "fhiclcpp/ParameterSet.h"
5 # include "fhiclcpp/make_ParameterSet.h"
12 #include "messagefacility/MessageLogger/MessageLogger.h"
17 mf::SetApplicationName(
"anotherLogger");
19 mf::LogWarning(
"warn1 | warn2") <<
"Followed by a WARNING message.";
20 mf::LogDebug(
"debug") <<
"The debug message in the other thread";
30 std::ostringstream ss;
31 std::ifstream logfhicl(
"MessageFacility.cfg");
32 if (logfhicl.is_open())
34 std::stringstream fhiclstream;
35 fhiclstream << logfhicl.rdbuf();
36 ss << fhiclstream.str();
38 fhicl::ParameterSet pset;
39 std::string pstr(ss.str());
40 fhicl::make_ParameterSet(pstr, pset);
41 mf::StartMessageFacility(pset);
43 catch (std::exception& e)
45 std::cerr <<
"Catched\n" << e.what();
50 mf::SetApplicationName(
"mftest");
66 for (
int i = 0; i < 2; ++i)
70 sprintf(buf,
"mftest-%d", i);
71 mf::SetApplicationName(buf);
74 mf::LogError(
"catError") <<
"Error information. " << i;
75 mf::LogWarning(
"catWarning") <<
"Warning information. " << i;
76 mf::LogInfo(
"catInfo") <<
"Info information. " << i;
77 LOG_DEBUG(
"debug") <<
"DEBUG information. " << i;