2 #define ML_DEBUG // always enable debug
9 #include "fhiclcpp/ParameterSet.h"
10 #include "fhiclcpp/make_ParameterSet.h"
12 #include "messagefacility/MessageLogger/MessageLogger.h"
14 void anotherLogger() {
16 mf::SetApplicationName(
"anotherLogger");
18 mf::LogWarning(
"warn1 | warn2") <<
"Followed by a WARNING message.";
19 mf::LogDebug(
"debug") <<
"The debug message in the other thread";
27 std::ostringstream ss;
28 std::ifstream logfhicl(
"MessageFacility.cfg");
29 if (logfhicl.is_open()) {
30 std::stringstream fhiclstream;
31 fhiclstream << logfhicl.rdbuf();
32 ss << fhiclstream.str();
34 fhicl::ParameterSet pset;
35 std::string pstr(ss.str());
36 fhicl::make_ParameterSet(pstr, pset);
37 mf::StartMessageFacility(pset);
38 }
catch (std::exception& e) {
39 std::cerr <<
"Catched\n" << e.what();
44 mf::SetApplicationName(
"mftest");
60 for (
int i = 0; i < 2; ++i) {
62 sprintf(buf,
"mftest-%d", i);
63 mf::SetApplicationName(buf);
66 mf::LogError(
"catError") <<
"Error information. " << i;
67 mf::LogWarning(
"catWarning") <<
"Warning information. " << i;
68 mf::LogInfo(
"catInfo") <<
"Info information. " << i;
69 LOG_DEBUG(
"debug") <<
"DEBUG information. " << i;