00001 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00002 #include "FWCore/MessageLogger/interface/MessageDrop.h" 00003 00004 // Change Log 00005 // 00006 // 12/12/07 mf elimination of dummyLogDebugObject_, dummyLogTraceObject_ 00007 // (see change log 8 in MessageLogger.h) 00008 // 00009 // 12/14/07 mf Moved the static free function onlyLowestDirectory 00010 // to a class member function of LogDebug_, changing 00011 // name to a more descriptive stripLeadingDirectoryTree. 00012 // Cures the 2600-copies-of-this-function complaint. 00013 // Implementation of this is moved into this .cc file. 00014 // 00015 // 6/20/08 mf Have flushMessageLog() check messageLoggerScribeIsRunning 00016 // (in the message drop) to avoid hangs if that thread is not 00017 // around. 00018 // 00019 // ------------------------------------------------------------------------ 00020 00021 namespace edm { 00022 00023 void LogStatistics() { 00024 edm::MessageLoggerQ::MLqSUM ( ); // trigger summary info 00025 } 00026 00027 bool isDebugEnabled() { 00028 return ( edm::MessageDrop::instance()->debugEnabled ); 00029 } 00030 00031 bool isInfoEnabled() { 00032 return( edm::MessageDrop::instance()->infoEnabled ); 00033 } 00034 00035 bool isWarningEnabled() { 00036 return( edm::MessageDrop::instance()->warningEnabled ); 00037 } 00038 00039 void HaltMessageLogging() { 00040 edm::MessageLoggerQ::MLqSHT ( ); // Shut the logger up 00041 } 00042 00043 void FlushMessageLog() { 00044 if (MessageDrop::instance()->messageLoggerScribeIsRunning != 00045 MLSCRIBE_RUNNING_INDICATOR) return; // 6/20/08 mf 00046 edm::MessageLoggerQ::MLqFLS ( ); // Flush the message log queue 00047 } 00048 00049 bool isMessageProcessingSetUp() { // 6/20/08 mf 00050 // std::cerr << "isMessageProcessingSetUp: \n"; 00051 // std::cerr << "messageLoggerScribeIsRunning = " 00052 // << (int)MessageDrop::instance()->messageLoggerScribeIsRunning << "\n"; 00053 return (MessageDrop::instance()->messageLoggerScribeIsRunning == 00054 MLSCRIBE_RUNNING_INDICATOR); 00055 } 00056 00057 void GroupLogStatistics(std::string const & category) { 00058 std::string * cat_p = new std::string(category); 00059 edm::MessageLoggerQ::MLqGRP (cat_p); // Indicate a group summary category 00060 // Note that the scribe will be responsible for deleting cat_p 00061 } 00062 00063 std::string 00064 edm::LogDebug_::stripLeadingDirectoryTree(const std::string & file) const { 00065 std::string::size_type lastSlash = file.find_last_of('/'); 00066 if (lastSlash == std::string::npos) return file; 00067 if (lastSlash == file.size()-1) return file; 00068 return file.substr(lastSlash+1, file.size()-lastSlash-1); 00069 } 00070 00071 } // namespace edm