00001 #ifndef OTSDAQ_CORE_MESSAGEFACILITY_MESSAGEFACILITY_H
00002 #define OTSDAQ_CORE_MESSAGEFACILITY_MESSAGEFACILITY_H
00003
00004 #include <messagefacility/MessageLogger/MessageLogger.h>
00005 #include "artdaq-core/Utilities/configureMessageFacility.hh"
00006 #include "otsdaq-core/Macros/CoutHeaderMacros.h"
00007
00008 namespace ots
00009 {
00010
00011 inline void INIT_MF(const char* name)
00012 {
00013 char* logRootString = getenv("OTSDAQ_LOG_ROOT");
00014 if (logRootString == nullptr)
00015 {
00016
00017 __COUT_ERR__ << "\n**********************************************************" << std::endl;
00018 __COUT_ERR__ << "WARNING: OTSDAQ_LOG_ROOT environment variable was not set!" << std::endl;
00019 __COUT_ERR__ << "**********************************************************\n" << std::endl;;
00020
00021 }
00022 else
00023 setenv("ARTDAQ_LOG_ROOT", logRootString, 1);
00024
00025 char* logFhiclCode = getenv("OTSDAQ_LOG_FHICL");
00026 if (logFhiclCode == nullptr)
00027 {
00028 __COUT_ERR__ << "\n***********************************************************" << std::endl;
00029 __COUT_ERR__ << "WARNING: OTSDAQ_LOG_FHICL environment variable was not set!" << std::endl;
00030 __COUT_ERR__ << "***********************************************************\n" << std::endl;
00031
00032 }
00033 else
00034 setenv("ARTDAQ_LOG_FHICL", logFhiclCode, 1);
00035
00036 artdaq::configureMessageFacility(name,true,true);
00037 artdaq::setMsgFacAppName(name,0);
00038 }
00039
00040
00041 }
00042
00043 #endif