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"
19 void anotherLogger() {
21 mf::SetApplicationName(
"anotherLogger");
23 mf::LogWarning(
"warn1 | warn2") <<
"Followed by a WARNING message.";
24 mf::LogDebug(
"debug") <<
"The debug message in the other thread";
32 std::ostringstream ss;
33 std::ifstream logfhicl(
"MessageFacility.cfg");
34 if (logfhicl.is_open()) {
35 std::stringstream fhiclstream;
36 fhiclstream << logfhicl.rdbuf();
37 ss << fhiclstream.str();
39 fhicl::ParameterSet pset;
40 std::string pstr(ss.str());
41 fhicl::make_ParameterSet(pstr, pset);
42 mf::StartMessageFacility(pset);
43 }
catch (std::exception& e) {
44 std::cerr <<
"Catched\n" << e.what();
49 mf::SetApplicationName(
"mftest");
65 for (
int i = 0; i < 2; ++i) {
67 sprintf(buf,
"mftest-%d", i);
68 mf::SetApplicationName(buf);
71 mf::LogError(
"catError") <<
"Error information. " << i;
72 mf::LogWarning(
"catWarning") <<
"Warning information. " << i;
73 mf::LogInfo(
"catInfo") <<
"Info information. " << i;
74 #if MESSAGEFACILITY_HEX_VERSION < 0x20300
75 LOG_DEBUG(
"debug") <<
"DEBUG information. " << i;
77 MF_LOG_DEBUG(
"debug") <<
"DEBUG information. " << i;