Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:28:40

0001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0002 #include "FWCore/MessageLogger/interface/MessageLoggerQ.h"
0003 
0004 // ------------------------------------------------------------------------
0005 
0006 namespace edm {
0007 
0008   void LogStatistics() {
0009     edm::MessageLoggerQ::MLqSUM();  // trigger summary info
0010   }
0011 
0012   bool isDebugEnabled() {
0013     return ((!edm::MessageDrop::debugAlwaysSuppressed) && edm::MessageDrop::instance()->debugEnabled);
0014   }
0015 
0016   bool isInfoEnabled() {
0017     return ((!edm::MessageDrop::infoAlwaysSuppressed) && edm::MessageDrop::instance()->infoEnabled);
0018   }
0019 
0020   bool isFwkInfoEnabled() {
0021     return ((!edm::MessageDrop::fwkInfoAlwaysSuppressed) && edm::MessageDrop::instance()->fwkInfoEnabled);
0022   }
0023 
0024   bool isWarningEnabled() {
0025     return ((!edm::MessageDrop::warningAlwaysSuppressed) && edm::MessageDrop::instance()->warningEnabled);
0026   }
0027 
0028   bool isErrorEnabled() { return edm::MessageDrop::instance()->errorEnabled; }
0029 
0030   void HaltMessageLogging() {
0031     edm::MessageLoggerQ::MLqSHT();  // Shut the logger up
0032   }
0033 
0034   void FlushMessageLog() {
0035     if (MessageDrop::instance()->messageLoggerScribeIsRunning != MLSCRIBE_RUNNING_INDICATOR)
0036       return;
0037     edm::MessageLoggerQ::MLqFLS();  // Flush the message log queue
0038   }
0039 
0040   void clearMessageLog() { MessageDrop::instance()->clear(); }
0041 
0042   bool isMessageProcessingSetUp() {
0043     //  std::cerr << "isMessageProcessingSetUp: \n";
0044     //  std::cerr << "messageLoggerScribeIsRunning = "
0045     //            << (int)MessageDrop::instance()->messageLoggerScribeIsRunning << "\n";
0046     return (MessageDrop::instance()->messageLoggerScribeIsRunning == MLSCRIBE_RUNNING_INDICATOR);
0047   }
0048 
0049   void GroupLogStatistics(std::string_view category) {
0050     std::string* cat_p = new std::string(category);
0051     edm::MessageLoggerQ::MLqGRP(cat_p);  // Indicate a group summary category
0052     // Note that the scribe will be responsible for deleting cat_p
0053   }
0054 
0055   edm::LogDebug_::LogDebug_(std::string_view id, std::string_view file, int line) : Log<level::Debug, false>(id) {
0056     *this << " " << stripLeadingDirectoryTree(file) << ":" << line << "\n";
0057   }
0058 
0059   std::string_view edm::LogDebug_::stripLeadingDirectoryTree(const std::string_view file) const {
0060     std::string_view::size_type lastSlash = file.find_last_of('/');
0061     if (lastSlash == std::string_view::npos)
0062       return file;
0063     if (lastSlash == file.size() - 1)
0064       return file;
0065     return file.substr(lastSlash + 1, file.size() - lastSlash - 1);
0066   }
0067 
0068   void setStandAloneMessageThreshold(edm::messagelogger::ELseverityLevel const& severity) {
0069     edm::MessageLoggerQ::standAloneThreshold(severity);
0070   }
0071   void squelchStandAloneMessageCategory(std::string const& category) { edm::MessageLoggerQ::squelch(category); }
0072 
0073 }  // namespace edm