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 ELseverityLevel& sev) const;
82  int severityCount(const ELseverityLevel& from, const ELseverityLevel& to) const;
83  void resetSeverityCount(const ELseverityLevel& sev);
84  void resetSeverityCount(const ELseverityLevel& from, const ELseverityLevel& to);
85  void resetSeverityCount(); // reset all
86 
87  // --- apply the following actions to all attached destinations:
88  //
89  void setThresholds(const ELseverityLevel& sev);
90  void setLimits(const std::string& id, int limit);
91  void setLimits(const ELseverityLevel& sev, int limit);
92  void setIntervals(const std::string& id, int interval);
93  void setIntervals(const ELseverityLevel& sev, int interval);
94  void setTimespans(const std::string& id, int seconds);
95  void setTimespans(const ELseverityLevel& sev, int seconds);
96  void wipe();
97  void finish();
98 
99  protected:
100  // --- member data accessors:
101  //
102  const ELseverityLevel& abortThreshold() const;
103  const ELseverityLevel& exitThreshold() const;
104  const ELseverityLevel& highSeverity() const;
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
edm::service::ELadministrator::resetSeverityCount
void resetSeverityCount()
Definition: ELadministrator.cc:158
service
Definition: service.py:1
ELlist.h
propagate_const.h
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ErrorObj
Definition: ErrorObj.h:43
edm::service::ELadministrator::severityCounts
int severityCounts(int lev) const
Definition: ELadministrator.cc:169
to
ErrorObj.h
edm::service::ELadministrator::ELadministrator
ELadministrator()
Definition: ELadministrator.cc:233
mps_check.msg
tuple msg
Definition: mps_check.py:285
edm::service::ELadministrator::setThresholds
void setThresholds(const ELseverityLevel &sev)
Definition: ELadministrator.cc:179
edm::service::ELadministrator::highSeverity_
ELseverityLevel highSeverity_
Definition: ELadministrator.h:111
edm::service::ELadministrator::abortThreshold
const ELseverityLevel & abortThreshold() const
edm::service::ELadministrator::severityCount
int severityCount(const ELseverityLevel &sev) const
Definition: ELadministrator.cc:131
edm::service::ELadministrator::setLimits
void setLimits(const std::string &id, int limit)
Definition: ELadministrator.cc:185
edm::service::ELadministrator::setIntervals
void setIntervals(const std::string &id, int interval)
Definition: ELadministrator.cc:197
edm::service::ELadministrator
Definition: ELadministrator.h:66
seconds
double seconds()
edm::service::ELadministrator::wipe
void wipe()
Definition: ELadministrator.cc:221
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ELdestination.h
edm::service::ELadministrator::exitThreshold
const ELseverityLevel & exitThreshold() const
edm::service::ELadministrator::~ELadministrator
~ELadministrator()
Definition: ELadministrator.cc:245
edm::ELseverityLevel::nLevels
Definition: ELseverityLevel.h:53
edm::service::ELadministrator::checkSeverity
ELseverityLevel checkSeverity()
Definition: ELadministrator.cc:124
readEcalDQMStatus.interval
interval
Definition: readEcalDQMStatus.py:18
ELseverityLevel.h
edm::service::ELadministrator::setTimespans
void setTimespans(const std::string &id, int seconds)
Definition: ELadministrator.cc:209
edm::ELseverityLevel
Definition: ELseverityLevel.h:26
remoteMonitoring_LED_IterMethod_cfg.limit
limit
Definition: remoteMonitoring_LED_IterMethod_cfg.py:427
edm::service::ELadministrator::sinks_
std::list< edm::propagate_const< std::shared_ptr< ELdestination > > > sinks_
Definition: ELadministrator.h:110
edm::service::ELadministrator::finish
void finish()
Definition: ELadministrator.cc:227
edm::service::ELadministrator::log
void log(edm::ErrorObj &msg)
Definition: ELadministrator.cc:93
edm::service::ELadministrator::highSeverity
const ELseverityLevel & highSeverity() const
Definition: ELadministrator.cc:167
edm::service::ELadministrator::severityCounts_
int severityCounts_[ELseverityLevel::nLevels]
Definition: ELadministrator.h:112
edm::service::ELadministrator::attach
std::shared_ptr< ELdestination > attach(std::shared_ptr< ELdestination > sink)
Definition: ELadministrator.cc:118
edm::service::ELadministrator::attachedDestinations_
std::map< std::string, edm::propagate_const< std::shared_ptr< ELdestination > > > attachedDestinations_
Definition: ELadministrator.h:114