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/CoutMacros.h"
00007
00008
00009 namespace ots
00010 {
00011
00012 inline void INIT_MF(const char* name)
00013 {
00014 char* logRootString = getenv("OTSDAQ_LOG_ROOT");
00015 if (logRootString == nullptr)
00016 {
00017
00018 __COUT_ERR__ << "\n**********************************************************" << std::endl;
00019 __COUT_ERR__ << "WARNING: OTSDAQ_LOG_ROOT environment variable was not set!" << std::endl;
00020 __COUT_ERR__ << "**********************************************************\n" << std::endl;;
00021
00022 }
00023 else
00024 setenv("ARTDAQ_LOG_ROOT", logRootString, 1);
00025
00026 char* logFhiclCode = getenv("OTSDAQ_LOG_FHICL");
00027 if (logFhiclCode == nullptr)
00028 {
00029 __COUT_ERR__ << "\n***********************************************************" << std::endl;
00030 __COUT_ERR__ << "WARNING: OTSDAQ_LOG_FHICL environment variable was not set!" << std::endl;
00031 __COUT_ERR__ << "***********************************************************\n" << std::endl;
00032
00033 }
00034 else
00035 setenv("ARTDAQ_LOG_FHICL", logFhiclCode, 1);
00036
00037 artdaq::configureMessageFacility(
00038 name ,
00039 false ,
00040 true );
00041
00042 artdaq::setMsgFacAppName(name,0);
00043 }
00044
00045
00046 }
00047
00048 #endif