Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-06-21 23:58:53

0001 #ifndef EDM_ML_DEBUG
0002 #define EDM_ML_DEBUG
0003 #endif
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 
0006 namespace edmtest {
0007 
0008   void sampleStandAlone() {
0009     LogDebug("cat_A");  //test stand alone declaration
0010     LogDebug("cat_A").log([](auto&& iLog) { iLog << " LogDebug.log was called"; });
0011     LogDebug("cat_A") << "LogDebug    was used to send cat_A";
0012     LogDebug("cat_B") << "LogDebug    was used to send cat_B";
0013     LogTrace("cat_A") << "LogTrace    was used to send cat_A";
0014     LogTrace("cat_B") << "LogTrace    was used to send cat_B";
0015     edm::LogInfo("cat_A") << "LogInfo     was used to send cat_A";
0016     edm::LogInfo("cat_B") << "LogInfo     was used to send cat_B";
0017     edm::LogVerbatim("cat_A") << "LogVerbatim was used to send cat_A";
0018     edm::LogVerbatim("cat_B") << "LogVerbatim was used to send cat_B";
0019     edm::LogFwkInfo("cat_A") << "LogFwkInfo  was used to send cat_A";
0020     edm::LogFwkInfo("cat_B") << "LogFwkInfo  was used to send cat_B";
0021     edm::LogFwkVerbatim("cat_A") << "LogFwkVerbatim was used to send cat_A";
0022     edm::LogFwkVerbatim("cat_B") << "LogFwkVerbatim was used to send cat_B";
0023     edm::LogWarning("cat_A") << "LogWarning  was used to send cat_A";
0024     edm::LogWarning("cat_B") << "LogWarning  was used to send cat_B";
0025     edm::LogPrint("cat_A") << "LogPrint    was used to send cat_A";
0026     edm::LogPrint("cat_B") << "LogPrint    was used to send cat_B";
0027     edm::LogError("cat_A") << "LogError    was used to send cat_A";
0028     edm::LogError("cat_B") << "LogError    was used to send cat_B";
0029     edm::LogProblem("cat_A") << "LogProblem  was used to send cat_A";
0030     edm::LogProblem("cat_B") << "LogProblem  was used to send cat_B";
0031   }
0032 
0033 }  // namespace edmtest
0034 
0035 int main() {
0036   edm::LogImportant("note") << "Default settings";
0037   edmtest::sampleStandAlone();
0038 
0039   edm::LogImportant("note") << "threshold DEBUG";
0040   edm::setStandAloneMessageThreshold(edm::messagelogger::ELdebug);
0041   edmtest::sampleStandAlone();
0042 
0043   edm::LogImportant("note") << "threshold INFO";
0044   edm::setStandAloneMessageThreshold(edm::messagelogger::ELinfo);
0045   edmtest::sampleStandAlone();
0046 
0047   edm::LogImportant("note") << "threshold FWKINFO";
0048   edm::setStandAloneMessageThreshold(edm::messagelogger::ELfwkInfo);
0049   edmtest::sampleStandAlone();
0050 
0051   edm::LogImportant("note") << "threshold WARNING";
0052   edm::setStandAloneMessageThreshold(edm::messagelogger::ELwarning);
0053   edmtest::sampleStandAlone();
0054 
0055   edm::LogImportant("note") << "threshold ELerror";  // ERROR would confuse
0056                                                      // the grep checking that
0057                                                      // the runtests worked
0058   edm::setStandAloneMessageThreshold(edm::messagelogger::ELerror);
0059   edmtest::sampleStandAlone();
0060 
0061   edm::LogImportant("note") << "squelch cat_A";
0062   edm::squelchStandAloneMessageCategory("cat_A");
0063   edmtest::sampleStandAlone();
0064 
0065   edm::LogImportant("note") << "squelch cat_B";
0066   edm::squelchStandAloneMessageCategory("cat_B");
0067   edmtest::sampleStandAlone();
0068 
0069   return 0;
0070 }