CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Protected Attributes

edm::service::ELtsErrorLog Class Reference

#include <ELtsErrorLog.h>

Inheritance diagram for edm::service::ELtsErrorLog:
edm::service::ThreadSafeErrorLog< Mutex >

List of all members.

Public Member Functions

 ELtsErrorLog ()
 ELtsErrorLog (const ELstring &pkgName)
 ELtsErrorLog (const ELtsErrorLog &ee)
 ELtsErrorLog (const ErrorLog &ee)
void item (unsigned long n)
void item (long n)
void item (unsigned int n)
void item (int n)
void item (const ELstring &s)
void item (short n)
void item (unsigned short n)

Protected Member Functions

void dispatch (edm::ErrorObj &msg)
bool getELdestControl (const ELstring &name, ELdestControl &theDestControl) const
void initiateMsg (const ELseverityLevel &sev, const ELstring &id)
void initiateMsg (int debugLevel)
bool pokeMsg (edm::ErrorObj &msg)
void setDebugMessages (ELseverityLevel sev, ELstring id)
void setDebugVerbosity (int debugVerbosity)
ELseverityLevel setDiscardThreshold (ELseverityLevel sev)
int setHexTrigger (int trigger)
void setModule (const ELstring &modName)
void setPackage (const ELstring &pkgName)
void setProcess (const ELstring &procName)
void setSubroutine (const ELstring &subName)
virtual ~ELtsErrorLog ()

Protected Attributes

ELadministratora
ErrorLog e
edm::ErrorObj msg
bool msgIsActive
ELstring process

Detailed Description

Definition at line 27 of file ELtsErrorLog.h.


Constructor & Destructor Documentation

edm::service::ELtsErrorLog::ELtsErrorLog ( )

Definition at line 44 of file ELtsErrorLog.cc.

References gather_cfg::cout.

: a( ELadministrator::instance() )
, e()
, process("")
, msgIsActive (false)
, msg(ELunspecified, "...")
{
  #ifdef ErrorLogCONSTRUCTOR_TRACE
    std::cout << "Constructor for ThreadSafeErrorLog\n";
  #endif
}
edm::service::ELtsErrorLog::ELtsErrorLog ( const ELstring pkgName)

Definition at line 56 of file ELtsErrorLog.cc.

References gather_cfg::cout.

: a( ELadministrator::instance() )
, e(pkgName)
, process("")
, msgIsActive (false)
, msg(ELunspecified, "...")
{
  #ifdef ErrorLogCONSTRUCTOR_TRACE
    std::cout << "Constructor for ThreadSafeErrorLog (with pkgName = "
                                                        << pkgName << ")\n";
  #endif
}
edm::service::ELtsErrorLog::ELtsErrorLog ( const ErrorLog ee)

Definition at line 69 of file ELtsErrorLog.cc.

References gather_cfg::cout.

: a( ELadministrator::instance() )
, e(ee)
, process("")
, msgIsActive (false)
, msg(ELunspecified, "...")
{
  #ifdef ErrorLogCONSTRUCTOR_TRACE
    std::cout << "Constructor for ThreadSafeErrorLog from ErrorLog\n";
  #endif
}
edm::service::ELtsErrorLog::ELtsErrorLog ( const ELtsErrorLog ee)

Definition at line 81 of file ELtsErrorLog.cc.

References gather_cfg::cout.

: a( ELadministrator::instance() )
, e(ee.e)
, process(ee.process)
, msgIsActive (ee.msgIsActive)
, msg(ee.msg)
{
  #ifdef ErrorLogCONSTRUCTOR_TRACE
    std::cout << "Copy constructor for ThreadSafeErrorLog \n";
  #endif
}
edm::service::ELtsErrorLog::~ELtsErrorLog ( ) [protected, virtual]

Definition at line 93 of file ELtsErrorLog.cc.

References gather_cfg::cout.

{
  #ifdef ErrorLogCONSTRUCTOR_TRACE
    std::cout << "Destructor for ThreadSafeErrorLog\n";
  #endif
}

Member Function Documentation

void edm::service::ELtsErrorLog::dispatch ( edm::ErrorObj msg) [protected]

Definition at line 306 of file ELtsErrorLog.cc.

References a, edm::service::ELadministrator::abortThreshold(), edm::service::ELadministrator::attach(), benchmark_cfg::cerr, edm::service::ELadministrator::context_, edm::ELhighestSeverity, edm::ELseverityLevel::getLevel(), edm::service::ELadministrator::highSeverity_, edm::service::msgabort(), edm::ErrorObj::setReactedTo(), edm::ELextendedID::severity, edm::service::ELadministrator::severityCounts_, edm::service::ELadministrator::sinks(), and edm::ErrorObj::xid().

                                                 {

  // NOTE -- this is never called except in cases where a <Mutex> LOCK
  //         is in scope.  That is, this code should be treated as a
  //         critical section.

  // severity level statistics keeping:
  int lev = msg.xid().severity.getLevel();
  ++ a->severityCounts_[lev];
  if ( lev > a->highSeverity_.getLevel() )
    a->highSeverity_ = msg.xid().severity;

  // context-based editing (if specified; usually just returns)
  a->context_->editErrorObj( msg );

  // -----  send the message to each destination:
  //
  if (a->sinks().begin() == a->sinks().end())  {
    std::cerr << "\nERROR LOGGED WITHOUT DESTINATION!\n";
    std::cerr << "Attaching destination \"cerr\" to ELadministrator by default\n"
              << std::endl;
    a->attach(ELoutput(std::cerr));
  }
  std::list<boost::shared_ptr<ELdestination> >::iterator d;
  for ( d = a->sinks().begin();  d != a->sinks().end();  ++d )
    if (  (*d)->log( msg )  )
      msg.setReactedTo (true );


  if ( msg.xid().severity.getLevel() >= a->abortThreshold().getLevel()
                       &&
        a->abortThreshold() != ELhighestSeverity) {
    msgabort();
  }

}
bool edm::service::ELtsErrorLog::getELdestControl ( const ELstring name,
ELdestControl theDestControl 
) const [protected]

Definition at line 140 of file ELtsErrorLog.cc.

References a, and edm::service::ELadministrator::getELdestControl().

                                                                           {
    return a->getELdestControl ( name, theDestControl );
}
void edm::service::ELtsErrorLog::initiateMsg ( const ELseverityLevel sev,
const ELstring id 
) [protected]

Definition at line 150 of file ELtsErrorLog.cc.

References edm::ErrorObj::clear(), gather_cfg::cout, edm::service::ErrorLog::discarding, edm::service::ErrorLog::discardThreshold, e, edm::ELseverityLevel::getName(), edm::service::ErrorLog::module, msg, msgIsActive, process, edm::ErrorObj::set(), edm::ErrorObj::setModule(), edm::ErrorObj::setProcess(), edm::ErrorObj::setReactedTo(), edm::ErrorObj::setSubroutine(), and edm::service::ErrorLog::subroutine.

Referenced by item().

{
  if ( sev < e.discardThreshold ) {
    e.discarding = true;
    return;
  }
  e.discarding = false;
  #ifdef ErrorLogENDMSG_TRACE
    std::cout << "=:=:=: precautionary endmsg ( "
              << sev.getName() << ", " << id << ")\n";
  #endif

  // Unlike the case for ErrorLog, it is not necessary to check
  // msgIsActive because the calling code was forced to do that
  // (since if it WAS active, ELtsErrorLog can't do the Mutex LOCK.)

  // -----  form ErrorObj for this new message:
  //
  msg.clear();
  msgIsActive = true;
  msg.set          ( sev, id );
  msg.setProcess   ( process );
  msg.setModule    ( e.module );
  msg.setSubroutine( e.subroutine );
  msg.setReactedTo ( false );

  return;

}  // operator()( )
void edm::service::ELtsErrorLog::initiateMsg ( int  debugLevel) [protected]
void edm::service::ELtsErrorLog::item ( short  n)

Definition at line 253 of file ELtsErrorLog.cc.

References edm::service::ErrorLog::discarding, e, edm::ErrorObj::emitToken(), edm::service::ErrorLog::hexTrigger, m, and msg.

                                   {
  if (e.discarding) return;
  std::ostringstream  ost;
  ost << n << ' ';
  short m = (n<0) ? -n : n;
  if ( (e.hexTrigger >= 0) && (m >= e.hexTrigger) ) {
    ost << "[0x"
        << std::hex << std::setw(4) << std::setfill('0')
        << n << "] ";
  }
  msg.emitToken( ost.str() );
}
void edm::service::ELtsErrorLog::item ( unsigned short  n)

Definition at line 266 of file ELtsErrorLog.cc.

References edm::service::ErrorLog::discarding, e, edm::ErrorObj::emitToken(), edm::service::ErrorLog::hexTrigger, and msg.

                                            {
  if (e.discarding) return;
  std::ostringstream  ost;
  ost << n << ' ';
  if ( (e.hexTrigger >= 0) && (n >= e.hexTrigger) ) {
    ost << "[0x"
        << std::hex << std::setw(4) << std::setfill('0')
        << n << "] ";
  }
  msg.emitToken( ost.str() );
}
void edm::service::ELtsErrorLog::item ( unsigned long  n)

Definition at line 238 of file ELtsErrorLog.cc.

References edm::service::ErrorLog::discarding, e, edm::ErrorObj::emitToken(), edm::service::ErrorLog::hexTrigger, msg, and tablePrinter::width.

                                           {
  if (e.discarding) return;
  std::ostringstream  ost;
  ost << n << ' ';
  if ( (e.hexTrigger >= 0) &&
       (n >= static_cast<unsigned long>(e.hexTrigger)) ) {
    int width = 8;
    if ( n > 0xFFFFFFFFL ) width = 16;
    ost << "[0x"
        << std::hex << std::setw(width) << std::setfill('0')
        << n << "] ";
  }
  msg.emitToken( ost.str() );
}
void edm::service::ELtsErrorLog::item ( const ELstring s)

Definition at line 186 of file ELtsErrorLog.cc.

References edm::ELunspecified, edm::ErrorObj::emitToken(), initiateMsg(), msg, and msgIsActive.

                                             {
  if ( ! msgIsActive )
    initiateMsg ( ELunspecified, "..." );
  msg.emitToken( s );
}  // emitToken()
void edm::service::ELtsErrorLog::item ( int  n)

Definition at line 197 of file ELtsErrorLog.cc.

References edm::service::ErrorLog::discarding, e, edm::ErrorObj::emitToken(), edm::service::ErrorLog::hexTrigger, m, and msg.

                                {
  if (e.discarding) return;
  std::ostringstream  ost;
  ost << n << ' ';
  int m = (n<0) ? -n : n;
  if ( (e.hexTrigger >= 0) && (m >= e.hexTrigger) ) {
    ost << "[0x"
        << std::hex << std::setw(8) << std::setfill('0')
        << n << "] ";
  }
  msg.emitToken( ost.str() );
}
void edm::service::ELtsErrorLog::item ( unsigned int  n)

Definition at line 210 of file ELtsErrorLog.cc.

References edm::service::ErrorLog::discarding, e, edm::ErrorObj::emitToken(), edm::service::ErrorLog::hexTrigger, and msg.

                                          {
  if (e.discarding) return;
  std::ostringstream  ost;
  ost << n << ' ';
  if ( (e.hexTrigger >= 0) &&
       (n >= static_cast<unsigned int>(e.hexTrigger)) ) {
    ost << "[0x"
        << std::hex << std::setw(8) << std::setfill('0')
        << n << "] ";
  }
  msg.emitToken( ost.str() );
}
void edm::service::ELtsErrorLog::item ( long  n)

Definition at line 223 of file ELtsErrorLog.cc.

References edm::service::ErrorLog::discarding, e, edm::ErrorObj::emitToken(), edm::service::ErrorLog::hexTrigger, dttmaxenums::L, m, msg, and tablePrinter::width.

                                  {
  if (e.discarding) return;
  std::ostringstream  ost;
  ost << n << ' ';
  long m = (n<0) ? -n : n;
  if ( (e.hexTrigger >= 0) && (m >= e.hexTrigger) ) {
    int width = 8;
    if ( static_cast<unsigned long>(n) > 0xFFFFFFFFL ) width = 16;
    ost << "[0x"
        << std::hex << std::setw(width) << std::setfill('0')
        << n << "] ";
  }
  msg.emitToken( ost.str() );
}
bool edm::service::ELtsErrorLog::pokeMsg ( edm::ErrorObj msg) [protected]

Definition at line 282 of file ELtsErrorLog.cc.

References e, edm::ELextendedID::module, edm::service::ErrorLog::module, process, edm::ELextendedID::process, edm::ErrorObj::setModule(), edm::ErrorObj::setProcess(), edm::ErrorObj::setSubroutine(), edm::service::ErrorLog::subroutine, edm::ELextendedID::subroutine, and edm::ErrorObj::xid().

                                                {

  // -----  will we need to poke/restore info into the message?
  //
  bool updateProcess   ( msg.xid().process   .length() == 0 );
  bool updateModule    ( msg.xid().module    .length() == 0 );
  bool updateSubroutine( msg.xid().subroutine.length() == 0 );

  // -----  poke, if needed:
  //
  if ( updateProcess    )  msg.setProcess   ( process );
  if ( updateModule     )  msg.setModule    ( e.module );
  if ( updateSubroutine )  msg.setSubroutine( e.subroutine );

  return ( updateProcess || updateModule || updateSubroutine );

}
void edm::service::ELtsErrorLog::setDebugMessages ( ELseverityLevel  sev,
ELstring  id 
) [protected]

Definition at line 132 of file ELtsErrorLog.cc.

References e, and edm::service::ErrorLog::setDebugMessages().

                                                                     {
  e.setDebugMessages (sev, id);
}
void edm::service::ELtsErrorLog::setDebugVerbosity ( int  debugVerbosity) [protected]

Definition at line 128 of file ELtsErrorLog.cc.

References e, and edm::service::ErrorLog::setDebugVerbosity().

                                                        {
  e.setDebugVerbosity (debugVerbosity);
}
ELseverityLevel edm::service::ELtsErrorLog::setDiscardThreshold ( ELseverityLevel  sev) [protected]

Definition at line 124 of file ELtsErrorLog.cc.

References e, and edm::service::ErrorLog::setDiscardThreshold().

                                                                      {
  return e.setDiscardThreshold(sev);
}
int edm::service::ELtsErrorLog::setHexTrigger ( int  trigger) [protected]

Definition at line 120 of file ELtsErrorLog.cc.

References e, and edm::service::ErrorLog::setHexTrigger().

                                            {
  return e.setHexTrigger (trigger);
}
void edm::service::ELtsErrorLog::setModule ( const ELstring modName) [protected]

Definition at line 108 of file ELtsErrorLog.cc.

References e, and edm::service::ErrorLog::setModule().

                                                        {
  e.setModule (modName);
}  // setModule()
void edm::service::ELtsErrorLog::setPackage ( const ELstring pkgName) [protected]

Definition at line 112 of file ELtsErrorLog.cc.

References e, and edm::service::ErrorLog::setModule().

                                                         {
  e.setModule (pkgName);
}  // setPackage()
void edm::service::ELtsErrorLog::setProcess ( const ELstring procName) [protected]

Definition at line 116 of file ELtsErrorLog.cc.

References process.

                                                          {
  process = procName;
}  // setProcess()
void edm::service::ELtsErrorLog::setSubroutine ( const ELstring subName) [protected]

Definition at line 104 of file ELtsErrorLog.cc.

References e, and edm::service::ErrorLog::setSubroutine().

                                                            {
  e.setSubroutine (subName);
}  // setSubroutine()

Member Data Documentation

Definition at line 98 of file ELtsErrorLog.h.

Referenced by dispatch(), and getELdestControl().

Definition at line 102 of file ELtsErrorLog.h.

Referenced by initiateMsg(), and item().

Definition at line 101 of file ELtsErrorLog.h.

Referenced by initiateMsg(), and item().

Definition at line 100 of file ELtsErrorLog.h.

Referenced by initiateMsg(), pokeMsg(), and setProcess().