10 #include "fhiclcpp/ParameterSet.h"
11 #include "fhiclcpp/make_ParameterSet.h"
13 #include "messagefacility/MessageLogger/MessageLogger.h"
18 mf::SetApplicationName(
"anotherLogger");
20 mf::LogWarning(
"warn1 | warn2") <<
"Followed by a WARNING message.";
21 mf::LogDebug(
"debug") <<
"The debug message in the other thread";
29 std::ostringstream ss;
30 std::ifstream logfhicl(
"MessageFacility.cfg");
31 if (logfhicl.is_open())
33 std::stringstream fhiclstream;
34 fhiclstream << logfhicl.rdbuf();
35 ss << fhiclstream.str();
37 fhicl::ParameterSet pset;
38 std::string pstr(ss.str());
39 fhicl::make_ParameterSet(pstr, pset);
40 mf::StartMessageFacility(pset);
42 catch (std::exception& e)
44 std::cerr <<
"Catched\n"
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;
78 MF_LOG_DEBUG(
"debug") <<
"DEBUG information. " << i;