CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Attributes | Friends
edm::service::ELadministrator Class Reference

#include <ELadministrator.h>

Public Member Functions

ELdestControl attach (const ELdestination &sink)
 
ELdestControl attach (const ELdestination &sink, const ELstring &name)
 
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
 
std::list< std::shared_ptr
< ELdestination > > & 
sinks ()
 

Private Attributes

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

Friends

class ELcout
 
class MessageLoggerScribe
 
class ThreadSafeLogMessageLoggerScribe
 

Detailed Description

Definition at line 78 of file ELadministrator.h.

Constructor & Destructor Documentation

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

Definition at line 323 of file ELadministrator.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, and sinks().

323  {
324 
325  #ifdef ELadministratorCONSTRUCTOR_TRACE
326  std::cerr << "ELadministrator Destructor\n";
327  #endif
328 
329  sinks().clear();
330 
331 } // ~ELadministrator()
std::list< std::shared_ptr< ELdestination > > & sinks()
edm::service::ELadministrator::ELadministrator ( )
protected

Definition at line 306 of file ELadministrator.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, edm::ELseverityLevel::nLevels, and severityCounts_.

307 : sinks_ ( )
309 {
310 
311  #ifdef ELadministratorCONSTRUCTOR_TRACE
312  std::cerr << "ELadminstrator constructor\n";
313  #endif
314 
315  for ( int lev = 0; lev < ELseverityLevel::nLevels; ++lev )
316  severityCounts_[lev] = 0;
317 
318 }
int severityCounts_[ELseverityLevel::nLevels]
std::list< std::shared_ptr< ELdestination > > sinks_

Member Function Documentation

const ELseverityLevel& edm::service::ELadministrator::abortThreshold ( ) const
protected
ELdestControl edm::service::ELadministrator::attach ( const ELdestination sink)

Definition at line 128 of file ELadministrator.cc.

References edm::service::ELdestination::clone(), alignCSCRings::dest, and sinks().

Referenced by log().

128  {
129 
130  std::shared_ptr<ELdestination> dest(sink.clone());
131  sinks().push_back( dest );
132  return ELdestControl( dest );
133 
134 } // attach()
std::list< std::shared_ptr< ELdestination > > & sinks()
ELdestControl edm::service::ELadministrator::attach ( const ELdestination sink,
const ELstring name 
)

Definition at line 136 of file ELadministrator.cc.

References attachedDestinations_, edm::service::ELdestination::clone(), alignCSCRings::dest, mergeVDriftHistosByStation::name, and sinks().

137  {
138  std::shared_ptr<ELdestination> dest(sink.clone());
140  sinks().push_back( dest );
141  return ELdestControl( dest );
142 } // attach()
std::map< ELstring, std::shared_ptr< ELdestination > > attachedDestinations_
std::list< std::shared_ptr< ELdestination > > & sinks()
ELseverityLevel edm::service::ELadministrator::checkSeverity ( )

Definition at line 145 of file ELadministrator.cc.

References edm::ELzeroSeverity, and highSeverity_.

145  {
146 
147  const ELseverityLevel retval( highSeverity_ );
149  return retval;
150 
151 } // checkSeverity()
ELslProxy< ELzeroSeverityGen > const ELzeroSeverity
const ELseverityLevel& edm::service::ELadministrator::exitThreshold ( ) const
protected
void edm::service::ELadministrator::finish ( )

Definition at line 297 of file ELadministrator.cc.

References begin, ztail::d, and sinks().

Referenced by progressbar.ProgressBar::__next__().

297  {
298 
299  std::list<std::shared_ptr<ELdestination> >::iterator d;
300  for ( d = sinks().begin(); d != sinks().end(); ++d )
301  (*d)->finish();
302 
303 } // wipe()
tuple d
Definition: ztail.py:151
#define begin
Definition: vmac.h:30
std::list< std::shared_ptr< ELdestination > > & sinks()
const ELseverityLevel & edm::service::ELadministrator::highSeverity ( ) const
protected

Definition at line 207 of file ELadministrator.cc.

References highSeverity_.

207  {
208  return highSeverity_;
209 }
void edm::service::ELadministrator::log ( edm::ErrorObj msg)

Definition at line 97 of file ELadministrator.cc.

References attach(), begin, ecal_dqm_sourceclient-live_cfg::cerr, ztail::d, end, edm::ELseverityLevel::getLevel(), highSeverity_, edm::ErrorObj::setReactedTo(), edm::ELextendedID::severity, severityCounts_, sinks(), and edm::ErrorObj::xid().

97  {
98 
99 
100  // severity level statistics keeping: // $$ mf 6/7/01
101  int lev = msg.xid().severity.getLevel();
102  ++ severityCounts_[lev];
103  if ( lev > highSeverity_.getLevel() )
104  highSeverity_ = msg.xid().severity;
105 
106  // ----- send the message to each destination:
107  //
108  if (sinks().begin() == sinks().end()) {
109  std::cerr << "\nERROR LOGGED WITHOUT DESTINATION!\n";
110  std::cerr << "Attaching destination \"cerr\" to ELadministrator by default\n"
111  << std::endl;
112  attach(ELoutput(std::cerr));
113  }
114  std::list<std::shared_ptr<ELdestination> >::iterator d;
115  for ( d = sinks().begin(); d != sinks().end(); ++d )
116  if ( (*d)->log( msg ) )
117  msg.setReactedTo ( true );
118 
119  return;
120 
121 }
ELseverityLevel severity
Definition: ELextendedID.h:35
int severityCounts_[ELseverityLevel::nLevels]
virtual void setReactedTo(bool r)
Definition: ErrorObj.cc:204
tuple d
Definition: ztail.py:151
const ELextendedID & xid() const
Definition: ErrorObj.cc:147
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
std::list< std::shared_ptr< ELdestination > > & sinks()
ELdestControl attach(const ELdestination &sink)
void edm::service::ELadministrator::resetSeverityCount ( const ELseverityLevel sev)

Definition at line 177 of file ELadministrator.cc.

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

177  {
178 
179  severityCounts_[sev.getLevel()] = 0;
180 
181 } // resetSeverityCount()
int severityCounts_[ELseverityLevel::nLevels]
void edm::service::ELadministrator::resetSeverityCount ( const ELseverityLevel from,
const ELseverityLevel to 
)

Definition at line 184 of file ELadministrator.cc.

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

185  {
186 
187  for ( int k = from.getLevel(); k <= to.getLevel(); ++k )
188  severityCounts_[k] = 0;
189 
190 } // resetSeverityCount()
int severityCounts_[ELseverityLevel::nLevels]
void edm::service::ELadministrator::resetSeverityCount ( )

Definition at line 193 of file ELadministrator.cc.

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

193  {
194 
196 
197 } // resetSeverityCount()
ELslProxy< ELhighestSeverityGen > const ELhighestSeverity
ELslProxy< ELzeroSeverityGen > const ELzeroSeverity
void edm::service::ELadministrator::setIntervals ( const ELstring id,
int  interval 
)

Definition at line 253 of file ELadministrator.cc.

References begin, ztail::d, and sinks().

253  {
254 
255  std::list<std::shared_ptr<ELdestination> >::iterator d;
256  for ( d = sinks().begin(); d != sinks().end(); ++d )
257  (*d)->limits.setInterval( id, interval );
258 
259 } // setIntervals()
tuple interval
Definition: MergeJob_cfg.py:20
tuple d
Definition: ztail.py:151
#define begin
Definition: vmac.h:30
std::list< std::shared_ptr< ELdestination > > & sinks()
void edm::service::ELadministrator::setIntervals ( const ELseverityLevel sev,
int  interval 
)

Definition at line 245 of file ELadministrator.cc.

References begin, and ztail::d.

245  {
246 
247  std::list<std::shared_ptr<ELdestination> >::iterator d;
248  for ( d = sinks().begin(); d != sinks().end(); ++d )
249  (*d)->limits.setInterval( sev, interval );
250 
251 } // setIntervals()
tuple interval
Definition: MergeJob_cfg.py:20
tuple d
Definition: ztail.py:151
#define begin
Definition: vmac.h:30
std::list< std::shared_ptr< ELdestination > > & sinks()
void edm::service::ELadministrator::setLimits ( const ELstring id,
int  limit 
)

Definition at line 235 of file ELadministrator.cc.

References begin, ztail::d, and sinks().

235  {
236 
237  std::list<std::shared_ptr<ELdestination> >::iterator d;
238  for ( d = sinks().begin(); d != sinks().end(); ++d )
239  (*d)->limits.setLimit( id, limit );
240 
241 } // setLimits()
tuple d
Definition: ztail.py:151
#define begin
Definition: vmac.h:30
std::list< std::shared_ptr< ELdestination > > & sinks()
void edm::service::ELadministrator::setLimits ( const ELseverityLevel sev,
int  limit 
)

Definition at line 262 of file ELadministrator.cc.

References begin, ztail::d, and sinks().

262  {
263 
264  std::list<std::shared_ptr<ELdestination> >::iterator d;
265  for ( d = sinks().begin(); d != sinks().end(); ++d )
266  (*d)->limits.setLimit( sev, limit );
267 
268 } // setLimits()
tuple d
Definition: ztail.py:151
#define begin
Definition: vmac.h:30
std::list< std::shared_ptr< ELdestination > > & sinks()
void edm::service::ELadministrator::setThresholds ( const ELseverityLevel sev)

Definition at line 226 of file ELadministrator.cc.

References begin, ztail::d, and sinks().

226  {
227 
228  std::list<std::shared_ptr<ELdestination> >::iterator d;
229  for ( d = sinks().begin(); d != sinks().end(); ++d )
230  (*d)->threshold = sev;
231 
232 } // setThresholds()
tuple d
Definition: ztail.py:151
#define begin
Definition: vmac.h:30
std::list< std::shared_ptr< ELdestination > > & sinks()
void edm::service::ELadministrator::setTimespans ( const ELstring id,
int  seconds 
)

Definition at line 271 of file ELadministrator.cc.

References begin, ztail::d, and sinks().

271  {
272 
273  std::list<std::shared_ptr<ELdestination> >::iterator d;
274  for ( d = sinks().begin(); d != sinks().end(); ++d )
275  (*d)->limits.setTimespan( id, seconds );
276 
277 } // setTimespans()
double seconds()
tuple d
Definition: ztail.py:151
#define begin
Definition: vmac.h:30
std::list< std::shared_ptr< ELdestination > > & sinks()
void edm::service::ELadministrator::setTimespans ( const ELseverityLevel sev,
int  seconds 
)

Definition at line 280 of file ELadministrator.cc.

References begin, ztail::d, and sinks().

280  {
281 
282  std::list<std::shared_ptr<ELdestination> >::iterator d;
283  for ( d = sinks().begin(); d != sinks().end(); ++d )
284  (*d)->limits.setTimespan( sev, seconds );
285 
286 } // setTimespans()
double seconds()
tuple d
Definition: ztail.py:151
#define begin
Definition: vmac.h:30
std::list< std::shared_ptr< ELdestination > > & sinks()
int edm::service::ELadministrator::severityCount ( const ELseverityLevel sev) const

Definition at line 154 of file ELadministrator.cc.

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

154  {
155 
156  return severityCounts_[sev.getLevel()];
157 
158 } // severityCount()
int severityCounts_[ELseverityLevel::nLevels]
int edm::service::ELadministrator::severityCount ( const ELseverityLevel from,
const ELseverityLevel to 
) const

Definition at line 161 of file ELadministrator.cc.

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

164  {
165 
166  int k = from.getLevel();
167  int sum = severityCounts_[k];
168 
169  while ( ++k != to.getLevel() )
170  sum += severityCounts_[k];
171 
172  return sum;
173 
174 } // severityCount()
int severityCounts_[ELseverityLevel::nLevels]
int edm::service::ELadministrator::severityCounts ( int  lev) const
protected

Definition at line 212 of file ELadministrator.cc.

References severityCounts_.

212  {
213  return severityCounts_[lev];
214 }
int severityCounts_[ELseverityLevel::nLevels]
std::list< std::shared_ptr< ELdestination > > & edm::service::ELadministrator::sinks ( )
protected

Definition at line 204 of file ELadministrator.cc.

References sinks_.

Referenced by attach(), finish(), log(), setIntervals(), setLimits(), setThresholds(), setTimespans(), wipe(), and ~ELadministrator().

204 { return sinks_; }
std::list< std::shared_ptr< ELdestination > > sinks_
void edm::service::ELadministrator::wipe ( )

Definition at line 289 of file ELadministrator.cc.

References begin, ztail::d, and sinks().

289  {
290 
291  std::list<std::shared_ptr<ELdestination> >::iterator d;
292  for ( d = sinks().begin(); d != sinks().end(); ++d )
293  (*d)->limits.wipe();
294 
295 } // wipe()
tuple d
Definition: ztail.py:151
#define begin
Definition: vmac.h:30
std::list< std::shared_ptr< ELdestination > > & sinks()

Friends And Related Function Documentation

friend class ELcout
friend

Definition at line 82 of file ELadministrator.h.

friend class MessageLoggerScribe
friend

Definition at line 80 of file ELadministrator.h.

friend class ThreadSafeLogMessageLoggerScribe
friend

Definition at line 81 of file ELadministrator.h.

Member Data Documentation

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

Definition at line 144 of file ELadministrator.h.

Referenced by attach().

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

Definition at line 141 of file ELadministrator.h.

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

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

Definition at line 140 of file ELadministrator.h.

Referenced by sinks().