CMS 3D CMS Logo

ELadministrator.h
Go to the documentation of this file.
1 #ifndef MessageService_ELadministrator_h
2 #define MessageService_ELadministrator_h
3 
4 // ----------------------------------------------------------------------
5 //
6 // ELadminstrator.h provides the singleton class that the framework uses to
7 // control logger behavior including attaching destinations.
8 // Includes the methods used by ErrorLog to evoke the logging
9 // behavior in the destinations owned by the ELadminstrator.
10 //
11 // ----------------------------------------------------------------------
12 //
13 // ELadministrator The singleton logger class. One does not instantiate
14 // an ELadministrator. Instead, do
15 // ELadministrator * logger = ELadministrator::instance();
16 // to get a pointer to the (unique) ELadministrator.
17 //
18 // Only the framework should use ELadministrator directly.
19 // Physicist users get at it indirectly through using an ErrorLog
20 // set up in their Module class.
21 //
22 // ELadminDestroyer A class whose sole purpose is the destruction of the
23 // ELadministrator when the program is over. Right now,
24 // we do not have anything that needs to be done when the
25 // ELadministrator (and thus the error logger) goes away;
26 // but since by not deleting the copies of ELdestination's
27 // that were attached we would be left with an apparent
28 // memory leak, we include a protected destructor which will
29 // clean up. ELadminDestroyer provides the only way for
30 // this destructor to be called.
31 //
32 // ----------------------------------------------------------------------
33 //
34 // 7/2/98 mf Created file.
35 // 2/29/00 mf Added method swapContextSupplier for ELrecv to use.
36 // 4/5/00 mf Added method swapProcess for same reason: ELrecv wants to
37 // be able to mock up the process and reset it afterward.
38 // 6/6/00 web Consolidate ELadministrator/X; adapt to consolidated
39 // ELcout/X.
40 // 6/14/00 web Declare classes before granting friendship.
41 // 6/4/01 mf Grant friedship to ELtsErrorLog
42 // 3/6/02 mf Items for recovering handles to attached destinations:
43 // the attachedDestinations map,
44 // an additional signature for attach(),
45 // and getELdestControl() method
46 // 3/17/04 mf exitThreshold and setExitThreshold
47 // 1/10/06 mf finish
48 //
49 // ----------------------------------------------------------------------
50 
56 
57 #include <memory>
58 
59 namespace edm {
60  namespace service {
61 
62  // ----------------------------------------------------------------------
63  // ELadministrator:
64  // ----------------------------------------------------------------------
65 
67  public:
70 
71  //Replaces ErrorLog which is no longer needed
72  void log(edm::ErrorObj& msg);
73 
74  // --- furnish/recall destinations:
75  //
76  std::shared_ptr<ELdestination> attach(std::shared_ptr<ELdestination> sink);
77 
78  // --- handle severity information:
79  //
81  int severityCount(const messagelogger::ELseverityLevel& sev) const;
85  void resetSeverityCount(); // reset all
86 
87  // --- apply the following actions to all attached destinations:
88  //
90  void setLimits(const std::string& id, int limit);
91  void setLimits(const messagelogger::ELseverityLevel& sev, int limit);
92  void setIntervals(const std::string& id, int interval);
94  void setTimespans(const std::string& id, int seconds);
96  void wipe();
97  void finish();
98 
99  protected:
100  // --- member data accessors:
101  //
105  int severityCounts(int lev) const;
106 
107  private:
108  // --- traditional member data:
109  //
110  std::list<edm::propagate_const<std::shared_ptr<ELdestination>>> sinks_;
113 
114  std::map<std::string, edm::propagate_const<std::shared_ptr<ELdestination>>> attachedDestinations_;
115 
116  }; // ELadministrator
117 
118  // ----------------------------------------------------------------------
119 
120  } // end of namespace service
121 } // end of namespace edm
122 
123 #endif // MessageService_ELadministrator_h
const messagelogger::ELseverityLevel & abortThreshold() const
void log(edm::ErrorObj &msg)
int severityCounts(int lev) const
std::shared_ptr< ELdestination > attach(std::shared_ptr< ELdestination > sink)
double seconds()
messagelogger::ELseverityLevel highSeverity_
std::map< std::string, edm::propagate_const< std::shared_ptr< ELdestination > > > attachedDestinations_
void setTimespans(const std::string &id, int seconds)
int severityCount(const messagelogger::ELseverityLevel &sev) const
int severityCounts_[messagelogger::ELseverityLevel::nLevels]
void setIntervals(const std::string &id, int interval)
void setThresholds(const messagelogger::ELseverityLevel &sev)
std::list< edm::propagate_const< std::shared_ptr< ELdestination > > > sinks_
tuple msg
Definition: mps_check.py:285
const messagelogger::ELseverityLevel & exitThreshold() const
HLT enums.
const messagelogger::ELseverityLevel & highSeverity() const
messagelogger::ELseverityLevel checkSeverity()
void setLimits(const std::string &id, int limit)