CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes | Friends
edm::service::ELadministrator Class Reference

#include <ELadministrator.h>

Public Member Functions

std::shared_ptr< ELdestinationattach (std::shared_ptr< ELdestination > sink)
 
ELseverityLevel checkSeverity ()
 
void finish ()
 
void log (edm::ErrorObj &msg)
 
void resetSeverityCount (const ELseverityLevel &sev)
 
void resetSeverityCount (const ELseverityLevel &from, const ELseverityLevel &to)
 
void resetSeverityCount ()
 
void setIntervals (const ELstring &id, int interval)
 
void setIntervals (const ELseverityLevel &sev, int interval)
 
void setLimits (const ELstring &id, int limit)
 
void setLimits (const ELseverityLevel &sev, int limit)
 
void setThresholds (const ELseverityLevel &sev)
 
void setTimespans (const ELstring &id, int seconds)
 
void setTimespans (const ELseverityLevel &sev, int seconds)
 
int severityCount (const ELseverityLevel &sev) const
 
int severityCount (const ELseverityLevel &from, const ELseverityLevel &to) const
 
void wipe ()
 
 ~ELadministrator ()
 

Protected Member Functions

const ELseverityLevelabortThreshold () const
 
 ELadministrator ()
 
const ELseverityLevelexitThreshold () const
 
const ELseverityLevelhighSeverity () const
 
int severityCounts (int lev) const
 

Private Attributes

std::map< ELstring, edm::propagate_const< std::shared_ptr< ELdestination > > > attachedDestinations_
 
ELseverityLevel highSeverity_
 
int severityCounts_ [ELseverityLevel::nLevels]
 
std::list< edm::propagate_const< std::shared_ptr< ELdestination > > > sinks_
 

Friends

class ELcout
 
class MessageLoggerScribe
 
class ThreadSafeLogMessageLoggerScribe
 

Detailed Description

Definition at line 75 of file ELadministrator.h.

Constructor & Destructor Documentation

edm::service::ELadministrator::~ELadministrator ( )

Definition at line 245 of file ELadministrator.cc.

References MessageLogger_cfi::cerr, and sinks_.

245  {
246 #ifdef ELadministratorCONSTRUCTOR_TRACE
247  std::cerr << "ELadministrator Destructor\n";
248 #endif
249 
250  sinks_.clear();
251 
252  } // ~ELadministrator()
std::list< edm::propagate_const< std::shared_ptr< ELdestination > > > sinks_
edm::service::ELadministrator::ELadministrator ( )
protected

Definition at line 233 of file ELadministrator.cc.

References MessageLogger_cfi::cerr, edm::ELseverityLevel::nLevels, and severityCounts_.

234 #ifdef ELadministratorCONSTRUCTOR_TRACE
235  std::cerr << "ELadminstrator constructor\n";
236 #endif
237 
238  for (int lev = 0; lev < ELseverityLevel::nLevels; ++lev)
239  severityCounts_[lev] = 0;
240  }
int severityCounts_[ELseverityLevel::nLevels]
std::list< edm::propagate_const< std::shared_ptr< ELdestination > > > sinks_

Member Function Documentation

const ELseverityLevel& edm::service::ELadministrator::abortThreshold ( ) const
protected
std::shared_ptr< ELdestination > edm::service::ELadministrator::attach ( std::shared_ptr< ELdestination sink)

Definition at line 118 of file ELadministrator.cc.

References sinks_.

Referenced by log().

118  {
119  sinks_.push_back(sink);
120  return sink;
121 
122  } // attach()
std::list< edm::propagate_const< std::shared_ptr< ELdestination > > > sinks_
ELseverityLevel edm::service::ELadministrator::checkSeverity ( )

Definition at line 124 of file ELadministrator.cc.

References edm::ELzeroSeverity, and highSeverity_.

124  {
125  const ELseverityLevel retval(highSeverity_);
127  return retval;
128 
129  } // checkSeverity()
ELslProxy< ELzeroSeverityGen > const ELzeroSeverity
const ELseverityLevel& edm::service::ELadministrator::exitThreshold ( ) const
protected
void edm::service::ELadministrator::finish ( )

Definition at line 227 of file ELadministrator.cc.

References sinks_.

Referenced by progressbar.ProgressBar::__next__().

227  {
228  for (auto& sink : sinks_)
229  sink->finish();
230 
231  } // wipe()
std::list< edm::propagate_const< std::shared_ptr< ELdestination > > > sinks_
const ELseverityLevel & edm::service::ELadministrator::highSeverity ( ) const
protected

Definition at line 167 of file ELadministrator.cc.

References highSeverity_.

167 { return highSeverity_; }
void edm::service::ELadministrator::log ( edm::ErrorObj msg)

Definition at line 93 of file ELadministrator.cc.

References attach(), MessageLogger_cfi::cerr, edm::ELseverityLevel::getLevel(), highSeverity_, edm::ErrorObj::setReactedTo(), edm::ELextendedID::severity, severityCounts_, sinks_, and edm::ErrorObj::xid().

93  {
94  // severity level statistics keeping: // $$ mf 6/7/01
95  int lev = msg.xid().severity.getLevel();
96  ++severityCounts_[lev];
97  if (lev > highSeverity_.getLevel())
98  highSeverity_ = msg.xid().severity;
99 
100  // ----- send the message to each destination:
101  //
102  if (sinks_.begin() == sinks_.end()) {
103  std::cerr << "\nERROR LOGGED WITHOUT DESTINATION!\n";
104  std::cerr << "Attaching destination \"cerr\" to ELadministrator by default\n" << std::endl;
105  attach(std::make_shared<ELoutput>(std::cerr));
106  }
107  for (auto& sink : sinks_)
108  if (sink->log(msg))
109  msg.setReactedTo(true);
110 
111  return;
112  }
ELseverityLevel severity
Definition: ELextendedID.h:29
int severityCounts_[ELseverityLevel::nLevels]
std::shared_ptr< ELdestination > attach(std::shared_ptr< ELdestination > sink)
virtual void setReactedTo(bool r)
Definition: ErrorObj.cc:176
const ELextendedID & xid() const
Definition: ErrorObj.cc:133
std::list< edm::propagate_const< std::shared_ptr< ELdestination > > > sinks_
void edm::service::ELadministrator::resetSeverityCount ( const ELseverityLevel sev)

Definition at line 147 of file ELadministrator.cc.

References edm::ELseverityLevel::getLevel(), and severityCounts_.

147  {
148  severityCounts_[sev.getLevel()] = 0;
149 
150  } // resetSeverityCount()
int severityCounts_[ELseverityLevel::nLevels]
void edm::service::ELadministrator::resetSeverityCount ( const ELseverityLevel from,
const ELseverityLevel to 
)

Definition at line 152 of file ELadministrator.cc.

References edm::ELseverityLevel::getLevel(), gen::k, and severityCounts_.

152  {
153  for (int k = from.getLevel(); k <= to.getLevel(); ++k)
154  severityCounts_[k] = 0;
155 
156  } // resetSeverityCount()
int severityCounts_[ELseverityLevel::nLevels]
int k[5][pyjets_maxn]
void edm::service::ELadministrator::resetSeverityCount ( )

Definition at line 158 of file ELadministrator.cc.

References edm::ELhighestSeverity, and edm::ELzeroSeverity.

158  {
160 
161  } // resetSeverityCount()
ELslProxy< ELhighestSeverityGen > const ELhighestSeverity
ELslProxy< ELzeroSeverityGen > const ELzeroSeverity
void edm::service::ELadministrator::setIntervals ( const ELstring id,
int  interval 
)

Definition at line 197 of file ELadministrator.cc.

References sinks_.

197  {
198  for (auto& sink : sinks_)
199  sink->limits.setInterval(id, interval);
200 
201  } // setIntervals()
std::list< edm::propagate_const< std::shared_ptr< ELdestination > > > sinks_
void edm::service::ELadministrator::setIntervals ( const ELseverityLevel sev,
int  interval 
)

Definition at line 191 of file ELadministrator.cc.

References sinks_.

191  {
192  for (auto& sink : sinks_)
193  sink->limits.setInterval(sev, interval);
194 
195  } // setIntervals()
std::list< edm::propagate_const< std::shared_ptr< ELdestination > > > sinks_
void edm::service::ELadministrator::setLimits ( const ELstring id,
int  limit 
)

Definition at line 185 of file ELadministrator.cc.

References sinks_.

185  {
186  for (auto& sink : sinks_)
187  sink->limits.setLimit(id, limit);
188 
189  } // setLimits()
std::list< edm::propagate_const< std::shared_ptr< ELdestination > > > sinks_
void edm::service::ELadministrator::setLimits ( const ELseverityLevel sev,
int  limit 
)

Definition at line 203 of file ELadministrator.cc.

References sinks_.

203  {
204  for (auto& sink : sinks_)
205  sink->limits.setLimit(sev, limit);
206 
207  } // setLimits()
std::list< edm::propagate_const< std::shared_ptr< ELdestination > > > sinks_
void edm::service::ELadministrator::setThresholds ( const ELseverityLevel sev)

Definition at line 179 of file ELadministrator.cc.

References sinks_.

179  {
180  for (auto& sink : sinks_)
181  sink->threshold = sev;
182 
183  } // setThresholds()
std::list< edm::propagate_const< std::shared_ptr< ELdestination > > > sinks_
void edm::service::ELadministrator::setTimespans ( const ELstring id,
int  seconds 
)

Definition at line 209 of file ELadministrator.cc.

References sinks_.

209  {
210  for (auto& sink : sinks_)
211  sink->limits.setTimespan(id, seconds);
212 
213  } // setTimespans()
double seconds()
std::list< edm::propagate_const< std::shared_ptr< ELdestination > > > sinks_
void edm::service::ELadministrator::setTimespans ( const ELseverityLevel sev,
int  seconds 
)

Definition at line 215 of file ELadministrator.cc.

References sinks_.

215  {
216  for (auto& sink : sinks_)
217  sink->limits.setTimespan(sev, seconds);
218 
219  } // setTimespans()
double seconds()
std::list< edm::propagate_const< std::shared_ptr< ELdestination > > > sinks_
int edm::service::ELadministrator::severityCount ( const ELseverityLevel sev) const

Definition at line 131 of file ELadministrator.cc.

References edm::ELseverityLevel::getLevel(), and severityCounts_.

131  {
132  return severityCounts_[sev.getLevel()];
133 
134  } // severityCount()
int severityCounts_[ELseverityLevel::nLevels]
int edm::service::ELadministrator::severityCount ( const ELseverityLevel from,
const ELseverityLevel to 
) const

Definition at line 136 of file ELadministrator.cc.

References edm::ELseverityLevel::getLevel(), gen::k, and severityCounts_.

136  {
137  int k = from.getLevel();
138  int sum = severityCounts_[k];
139 
140  while (++k != to.getLevel())
141  sum += severityCounts_[k];
142 
143  return sum;
144 
145  } // severityCount()
int severityCounts_[ELseverityLevel::nLevels]
int k[5][pyjets_maxn]
int edm::service::ELadministrator::severityCounts ( int  lev) const
protected

Definition at line 169 of file ELadministrator.cc.

References severityCounts_.

169 { return severityCounts_[lev]; }
int severityCounts_[ELseverityLevel::nLevels]
void edm::service::ELadministrator::wipe ( )

Definition at line 221 of file ELadministrator.cc.

References sinks_.

221  {
222  for (auto& sink : sinks_)
223  sink->limits.wipe();
224 
225  } // wipe()
std::list< edm::propagate_const< std::shared_ptr< ELdestination > > > sinks_

Friends And Related Function Documentation

friend class ELcout
friend

Definition at line 79 of file ELadministrator.h.

friend class MessageLoggerScribe
friend

Definition at line 77 of file ELadministrator.h.

friend class ThreadSafeLogMessageLoggerScribe
friend

Definition at line 78 of file ELadministrator.h.

Member Data Documentation

std::map<ELstring, edm::propagate_const<std::shared_ptr<ELdestination> > > edm::service::ELadministrator::attachedDestinations_
private

Definition at line 134 of file ELadministrator.h.

ELseverityLevel edm::service::ELadministrator::highSeverity_
private

Definition at line 131 of file ELadministrator.h.

Referenced by checkSeverity(), highSeverity(), and log().

int edm::service::ELadministrator::severityCounts_[ELseverityLevel::nLevels]
private
std::list<edm::propagate_const<std::shared_ptr<ELdestination> > > edm::service::ELadministrator::sinks_
private