Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:45

0001 #ifndef FWCore_MessageService_plugins_MessageLogger_h
0002 #define FWCore_MessageService_plugins_MessageLogger_h
0003 
0004 // -*- C++ -*-
0005 //
0006 // Package:     MessageService
0007 // Class  :     MessageLogger
0008 //
0009 /**\class edm::service::MessageLogger MessageLogger.h FWCore/MessageService/plugins/MessageLogger.h
0010 
0011  Description: <one line class summary>
0012 
0013  Usage:
0014     <usage>
0015 
0016 */
0017 //
0018 // Original Author:  W. Brown and M. Fischler
0019 //         Created:  Fri Nov 11 16:38:19 CST 2005
0020 //     Major Split:  Tue Feb 14 15:00:00 CST 2006
0021 //          See FWCore/MessageLogger/MessageLogger.h
0022 //
0023 
0024 // system include files
0025 
0026 #include <memory>
0027 #include <string>
0028 #include <set>
0029 #include <map>
0030 #include <vector>
0031 
0032 // user include files
0033 
0034 #include "DataFormats/Provenance/interface/EventID.h"
0035 #include "FWCore/MessageLogger/interface/ELseverityLevel.h"
0036 #include "FWCore/MessageLogger/interface/edm_MessageLogger.h"
0037 #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
0038 #include "FWCore/Utilities/interface/thread_safety_macros.h"
0039 
0040 // forward declarations
0041 
0042 namespace edm {
0043   class ModuleDescription;
0044   class ParameterSet;
0045   namespace service {
0046 
0047     class MessageLogger : public edm::MessageLogger {
0048     public:
0049       MessageLogger(ParameterSet const&, ActivityRegistry&);
0050 
0051       void setThreadContext(ModuleCallingContext const&) final;
0052 
0053     private:
0054       static void summarizeInJobReport();
0055 
0056       void postBeginJob();
0057       void preEndJob();
0058       void postEndJob();
0059       void jobFailure();
0060 
0061       void preSourceEvent(StreamID);
0062       void postSourceEvent(StreamID);
0063       void preSourceRunLumi();
0064       void postSourceRunLumi();
0065 
0066       void preFile(std::string const&);
0067       void preFileClose(std::string const&);
0068       void postFile(std::string const&);
0069 
0070       void preModuleConstruction(ModuleDescription const&);
0071       void postModuleConstruction(ModuleDescription const&);
0072 
0073       void preModuleDestruction(ModuleDescription const&);
0074       void postModuleDestruction(ModuleDescription const&);
0075 
0076       void preSourceConstruction(ModuleDescription const&);
0077       void postSourceConstruction(ModuleDescription const&);
0078 
0079       void preModuleEvent(StreamContext const&, ModuleCallingContext const&);
0080       void postModuleEvent(StreamContext const&, ModuleCallingContext const&);
0081 
0082       void preModuleEventAcquire(StreamContext const&, ModuleCallingContext const&);
0083       void postModuleEventAcquire(StreamContext const&, ModuleCallingContext const&);
0084 
0085       void preModuleBeginJob(ModuleDescription const&);
0086       void postModuleBeginJob(ModuleDescription const&);
0087       void preModuleEndJob(ModuleDescription const&);
0088       void postModuleEndJob(ModuleDescription const&);
0089 
0090       void preModuleBeginStream(StreamContext const&, ModuleCallingContext const&);
0091       void postModuleBeginStream(StreamContext const&, ModuleCallingContext const&);
0092       void preModuleEndStream(StreamContext const&, ModuleCallingContext const&);
0093       void postModuleEndStream(StreamContext const&, ModuleCallingContext const&);
0094 
0095       void preModuleStreamBeginRun(StreamContext const&, ModuleCallingContext const&);
0096       void postModuleStreamBeginRun(StreamContext const&, ModuleCallingContext const&);
0097       void preModuleStreamEndRun(StreamContext const&, ModuleCallingContext const&);
0098       void postModuleStreamEndRun(StreamContext const&, ModuleCallingContext const&);
0099 
0100       void preModuleStreamBeginLumi(StreamContext const&, ModuleCallingContext const&);
0101       void postModuleStreamBeginLumi(StreamContext const&, ModuleCallingContext const&);
0102       void preModuleStreamEndLumi(StreamContext const&, ModuleCallingContext const&);
0103       void postModuleStreamEndLumi(StreamContext const&, ModuleCallingContext const&);
0104 
0105       void preEvent(StreamContext const&);
0106       void postEvent(StreamContext const&);
0107 
0108       void preStreamBeginRun(StreamContext const&);
0109       void postStreamBeginRun(StreamContext const&);
0110       void preStreamEndRun(StreamContext const&);
0111       void postStreamEndRun(StreamContext const&);
0112       void preStreamBeginLumi(StreamContext const&);
0113       void postStreamBeginLumi(StreamContext const&);
0114       void preStreamEndLumi(StreamContext const&);
0115       void postStreamEndLumi(StreamContext const&);
0116 
0117       void preModuleBeginProcessBlock(GlobalContext const&, ModuleCallingContext const&);
0118       void postModuleBeginProcessBlock(GlobalContext const&, ModuleCallingContext const&);
0119       void preModuleAccessInputProcessBlock(GlobalContext const&, ModuleCallingContext const&);
0120       void postModuleAccessInputProcessBlock(GlobalContext const&, ModuleCallingContext const&);
0121       void preModuleEndProcessBlock(GlobalContext const&, ModuleCallingContext const&);
0122       void postModuleEndProcessBlock(GlobalContext const&, ModuleCallingContext const&);
0123 
0124       void preModuleGlobalBeginRun(GlobalContext const&, ModuleCallingContext const&);
0125       void postModuleGlobalBeginRun(GlobalContext const&, ModuleCallingContext const&);
0126       void preModuleGlobalEndRun(GlobalContext const&, ModuleCallingContext const&);
0127       void postModuleGlobalEndRun(GlobalContext const&, ModuleCallingContext const&);
0128       void preModuleWriteRun(GlobalContext const&, ModuleCallingContext const&);
0129       void postModuleWriteRun(GlobalContext const&, ModuleCallingContext const&);
0130 
0131       void preModuleGlobalBeginLumi(GlobalContext const&, ModuleCallingContext const&);
0132       void postModuleGlobalBeginLumi(GlobalContext const&, ModuleCallingContext const&);
0133       void preModuleGlobalEndLumi(GlobalContext const&, ModuleCallingContext const&);
0134       void postModuleGlobalEndLumi(GlobalContext const&, ModuleCallingContext const&);
0135       void preModuleWriteLumi(GlobalContext const&, ModuleCallingContext const&);
0136       void postModuleWriteLumi(GlobalContext const&, ModuleCallingContext const&);
0137 
0138       void preBeginProcessBlock(GlobalContext const&);
0139       void postBeginProcessBlock(GlobalContext const&);
0140       void preAccessInputProcessBlock(GlobalContext const&);
0141       void postAccessInputProcessBlock(GlobalContext const&);
0142       void preEndProcessBlock(GlobalContext const&);
0143       void postEndProcessBlock(GlobalContext const&);
0144 
0145       void preGlobalBeginRun(GlobalContext const&);
0146       void postGlobalBeginRun(GlobalContext const&);
0147       void preGlobalEndRun(GlobalContext const&);
0148       void postGlobalEndRun(GlobalContext const&);
0149       void preGlobalBeginLumi(GlobalContext const&);
0150       void postGlobalBeginLumi(GlobalContext const&);
0151       void preGlobalEndLumi(GlobalContext const&);
0152       void postGlobalEndLumi(GlobalContext const&);
0153 
0154       void prePathEvent(StreamContext const&, PathContext const&);
0155       void postPathEvent(StreamContext const&, PathContext const&, HLTPathStatus const&);
0156 
0157       void preESModule(eventsetup::EventSetupRecordKey const&, ESModuleCallingContext const&);
0158       void postESModule(eventsetup::EventSetupRecordKey const&, ESModuleCallingContext const&);
0159 
0160       // set up the module name in the message drop, and the enable/suppress info
0161       void establishModule(const ModuleDescription& desc, const char* whichPhase);
0162       void unEstablishModule(const ModuleDescription& desc, const char* whichPhase);
0163       void establishModule(unsigned int transitionIndex, const ModuleCallingContext& context, const char* whichPhase);
0164       void unEstablishModule(const ModuleCallingContext& desc, const char* whichPhase);
0165       void establish(const char* whichPhase);
0166       void unEstablish(const char* whichPhase);
0167 
0168       //Cache string description for each active transition
0169       // stream info is first in the container
0170       // concurrent lumi info is next
0171       // concurrent run info is last
0172       // The longest possible string needing to be cached is 51 chars
0173       std::vector<std::array<char, 64>> transitionInfoCache_;
0174       unsigned int lumiInfoBegin_ = 0;
0175       unsigned int runInfoBegin_ = 0;
0176       unsigned int processBlockInfoBegin_ = 0;
0177 
0178       std::set<std::string> debugEnabledModules_;
0179       std::map<std::string, messagelogger::ELseverityLevel> suppression_levels_;
0180       bool debugEnabled_;
0181       CMS_THREAD_SAFE static bool anyDebugEnabled_;
0182       CMS_THREAD_SAFE static bool everyDebugEnabled_;
0183 
0184       CMS_THREAD_SAFE static bool fjrSummaryRequested_;
0185       bool messageServicePSetHasBeenValidated_;
0186       std::string messageServicePSetValidatationResults_;
0187 
0188       bool nonModule_debugEnabled;
0189       bool nonModule_infoEnabled;
0190       bool nonModule_warningEnabled;
0191       bool nonModule_errorEnabled;
0192 
0193     };  // MessageLogger
0194 
0195     inline bool isProcessWideService(MessageLogger const*) { return true; }
0196 
0197   }  // namespace service
0198 
0199 }  // namespace edm
0200 
0201 #endif  // FWCore_MessageService_plugins_MessageLogger_h