otsdaq  v2_00_00
MessageFacility.h
1 #ifndef OTSDAQ_CORE_MESSAGEFACILITY_MESSAGEFACILITY_H
2 #define OTSDAQ_CORE_MESSAGEFACILITY_MESSAGEFACILITY_H
3 
4 #include <messagefacility/MessageLogger/MessageLogger.h>
5 #include "artdaq-core/Utilities/configureMessageFacility.hh"
6 #include "otsdaq-core/Macros/CoutHeaderMacros.h"
7 
8 namespace ots
9 {
10 
11 inline void INIT_MF(const char* name)
12 {
13  char* logRootString = getenv("OTSDAQ_LOG_ROOT");
14  if (logRootString == nullptr)
15  {
16 
17  __COUT_ERR__ << "\n**********************************************************" << std::endl;
18  __COUT_ERR__ << "WARNING: OTSDAQ_LOG_ROOT environment variable was not set!" << std::endl;
19  __COUT_ERR__ << "**********************************************************\n" << std::endl;;
20  //exit(0);
21  }
22  else
23  setenv("ARTDAQ_LOG_ROOT", logRootString, 1);
24 
25  char* logFhiclCode = getenv("OTSDAQ_LOG_FHICL");
26  if (logFhiclCode == nullptr)
27  {
28  __COUT_ERR__ << "\n***********************************************************" << std::endl;
29  __COUT_ERR__ << "WARNING: OTSDAQ_LOG_FHICL environment variable was not set!" << std::endl;
30  __COUT_ERR__ << "***********************************************************\n" << std::endl;
31  //exit(0);
32  }
33  else
34  setenv("ARTDAQ_LOG_FHICL", logFhiclCode, 1);
35 
36  artdaq::configureMessageFacility(name,true,true);
37  artdaq::setMsgFacAppName(name,0);
38 }
39 
40 
41 }
42 
43 #endif