CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Protected Attributes | Friends

edm::service::ELfwkJobReport Class Reference

#include <ELfwkJobReport.h>

Inheritance diagram for edm::service::ELfwkJobReport:
edm::service::ELdestination

List of all members.

Public Member Functions

virtual ELfwkJobReportclone () const
 ELfwkJobReport (std::ostream &os, bool emitAtStart=true)
 ELfwkJobReport (const ELstring &fileName, bool emitAtStart=true)
 ELfwkJobReport (const ELfwkJobReport &orig)
 ELfwkJobReport ()
virtual bool log (const ErrorObj &msg)
virtual ~ELfwkJobReport ()

Protected Member Functions

virtual void attachEpilogue ()
virtual void attachTime ()
virtual void changeFile (std::ostream &os)
virtual void changeFile (const ELstring &filename)
virtual void emitToken (const ELstring &s, bool nl=false)
virtual void finish ()
virtual void flush ()
virtual void includeContext ()
virtual void includeModule ()
virtual void includeSerial ()
virtual void includeSubroutine ()
virtual void includeText ()
virtual void includeTime ()
ELfwkJobReportoperator= (const ELfwkJobReport &orig)
virtual void separateEpilogue ()
virtual void separateTime ()
virtual void summarization (const ELstring &fullTitle, const ELstring &sumLines)
virtual void suppressContext ()
virtual void suppressModule ()
virtual void suppressSerial ()
virtual void suppressSubroutine ()
virtual void suppressText ()
virtual void suppressTime ()
virtual void useContext ()
virtual void useFullContext ()

Protected Attributes

int charsOnLine
boost::shared_ptr< std::ostream > os
bool wantEpilogueSeparate
bool wantFullContext
bool wantModule
bool wantSerial
bool wantSomeContext
bool wantSubroutine
bool wantText
bool wantTimeSeparate
bool wantTimestamp
ELextendedID xid

Friends

class ELdestControl

Detailed Description

Definition at line 37 of file ELfwkJobReport.h.


Constructor & Destructor Documentation

edm::service::ELfwkJobReport::ELfwkJobReport ( )

Definition at line 41 of file ELfwkJobReport.cc.

References benchmark_cfg::cerr, and emitToken().

Referenced by clone().

: ELdestination       (            )
, os                  ( &std::cerr, do_nothing_deleter() )
, charsOnLine         ( 0          )
, xid                 (            )
, wantTimestamp       ( true       )
, wantModule          ( true       )
, wantSubroutine      ( true       )
, wantText            ( true       )
, wantSomeContext     ( true       )
, wantSerial          ( false      )
, wantFullContext     ( false      )
, wantTimeSeparate    ( false      )
, wantEpilogueSeparate( false      )
{

  #ifdef ELfwkJobReportCONSTRUCTOR_TRACE
    std::cerr << "Constructor for ELfwkJobReport()\n";
  #endif

  // Opening xml tag
  emitToken( "<FrameworkJobReport>\n", true );

}  // ELfwkJobReport()
edm::service::ELfwkJobReport::ELfwkJobReport ( std::ostream &  os,
bool  emitAtStart = true 
)

Definition at line 67 of file ELfwkJobReport.cc.

References benchmark_cfg::cerr, and emitToken().

: ELdestination       (       )
, os                  ( &os_, do_nothing_deleter() )
, charsOnLine         ( 0     )
, xid                 (       )
, wantTimestamp       ( true  )
, wantModule          ( true  )
, wantSubroutine      ( true  )
, wantText            ( true  )
, wantSomeContext     ( true  )
, wantSerial          ( false )
, wantFullContext     ( false )
, wantTimeSeparate    ( false )
, wantEpilogueSeparate( false )
{

  #ifdef ELfwkJobReportCONSTRUCTOR_TRACE
    std::cerr << "Constructor for ELfwkJobReport( os )\n";
  #endif

  // Opening xml tag
  emitToken( "<FrameworkJobReport>\n\n", true );

}  // ELfwkJobReport()
edm::service::ELfwkJobReport::ELfwkJobReport ( const ELstring fileName,
bool  emitAtStart = true 
)

Definition at line 93 of file ELfwkJobReport.cc.

References benchmark_cfg::cerr, emitToken(), and os.

: ELdestination       (       )
, os                  ( new std::ofstream( fileName.c_str() , std::ios/*_base*/::app), close_and_delete())
, charsOnLine         ( 0     )
, xid                 (       )
, wantTimestamp       ( true  )
, wantModule          ( true  )
, wantSubroutine      ( true  )
, wantText            ( true  )
, wantSomeContext     ( true  )
, wantSerial          ( false )
, wantFullContext     ( false )
, wantTimeSeparate    ( false )
, wantEpilogueSeparate( false )
{

  #ifdef ELfwkJobReportCONSTRUCTOR_TRACE
    std::cerr << "Constructor for ELfwkJobReport( " << fileName << " )\n";
  #endif

  if ( os && *os )  {
    #ifdef ELfwkJobReportCONSTRUCTOR_TRACE
      std::cerr << "          Testing if os is owned\n";
    #endif
    #ifdef ELfwkJobReportCONSTRUCTOR_TRACE
      std::cerr << "          About to do first emit\n";
    #endif
    // Opening xml tag
    emitToken( "<FrameworkJobReport>\n");
  } else  {
    #ifdef ELfwkJobReportCONSTRUCTOR_TRACE
      std::cerr << "          Deleting os\n";
    #endif
    os.reset(&std::cerr, do_nothing_deleter());
    #ifdef ELfwkJobReportCONSTRUCTOR_TRACE
      std::cerr << "          about to emit to cerr\n";
    #endif
    // Opening xml tag
    emitToken( "<FrameworkJobReport>\n\n" );
  }

  #ifdef ELfwkJobReportCONSTRUCTOR_TRACE
    std::cerr << "Constructor for ELfwkJobReport completed.\n";
  #endif

}  // ELfwkJobReport()
edm::service::ELfwkJobReport::ELfwkJobReport ( const ELfwkJobReport orig)

Definition at line 141 of file ELfwkJobReport.cc.

References benchmark_cfg::cerr, edm::service::ELdestination::ignoreMostModules, edm::service::ELdestination::ignoreThese, edm::service::ELdestination::indent, edm::service::ELdestination::limits, edm::service::ELdestination::lineLength, edm::service::ELdestination::newline, edm::service::ELdestination::preamble, edm::service::ELdestination::respondToMostModules, edm::service::ELdestination::respondToThese, edm::service::ELdestination::threshold, and edm::service::ELdestination::traceThreshold.

: ELdestination       (                           )
, os                  ( orig.os                   )
, charsOnLine         ( orig.charsOnLine          )
, xid                 ( orig.xid                  )
, wantTimestamp       ( orig.wantTimestamp        )
, wantModule          ( orig.wantModule           )
, wantSubroutine      ( orig.wantSubroutine       )
, wantText            ( orig.wantText             )
, wantSomeContext     ( orig.wantSomeContext      )
, wantSerial          ( orig.wantSerial           )
, wantFullContext     ( orig.wantFullContext      )
, wantTimeSeparate    ( orig.wantTimeSeparate     )
, wantEpilogueSeparate( orig.wantEpilogueSeparate )
{

  #ifdef ELfwkJobReportCONSTRUCTOR_TRACE
    std::cerr << "Copy constructor for ELfwkJobReport\n";
  #endif

  // mf 6/15/01 fix of Bug 005
  threshold             = orig.threshold;
  traceThreshold        = orig.traceThreshold;
  limits                = orig.limits;
  preamble              = orig.preamble;
  newline               = orig.newline;
  indent                = orig.indent;
  lineLength            = orig.lineLength;

  ignoreMostModules     = orig.ignoreMostModules;
  respondToThese        = orig.respondToThese;
  respondToMostModules  = orig.respondToMostModules;
  ignoreThese           = orig.ignoreThese;

}  // ELfwkJobReport()
edm::service::ELfwkJobReport::~ELfwkJobReport ( ) [virtual]

Definition at line 178 of file ELfwkJobReport.cc.

References benchmark_cfg::cerr.

                                 {

  #ifdef ELfwkJobReportCONSTRUCTOR_TRACE
    std::cerr << "Destructor for ELfwkJobReport\n";
  #endif
}  // ~ELfwkJobReport()

Member Function Documentation

void edm::service::ELfwkJobReport::attachEpilogue ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 352 of file ELfwkJobReport.cc.

References wantEpilogueSeparate.

{ wantEpilogueSeparate = false; }
void edm::service::ELfwkJobReport::attachTime ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 349 of file ELfwkJobReport.cc.

References wantTimeSeparate.

{ wantTimeSeparate = false; }
void edm::service::ELfwkJobReport::changeFile ( std::ostream &  os) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 393 of file ELfwkJobReport.cc.

References emitToken(), and os.

                                                 {
  os.reset(&os_, do_nothing_deleter());
  emitToken( "\n=======================================================", true );
  emitToken( "\nError Log changed to this stream\n" );
  emitToken( "\n=======================================================\n", true );
}
void edm::service::ELfwkJobReport::changeFile ( const ELstring filename) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 400 of file ELfwkJobReport.cc.

References emitToken(), and os.

                                                          {
  os.reset(new std::ofstream( filename.c_str(), std::ios/*_base*/::app ), close_and_delete());
  emitToken( "\n=======================================================", true );
  emitToken( "\nError Log changed to this file\n" );
  emitToken( "\n=======================================================\n", true );
}
ELfwkJobReport * edm::service::ELfwkJobReport::clone ( void  ) const [virtual]

Implements edm::service::ELdestination.

Definition at line 191 of file ELfwkJobReport.cc.

References ELfwkJobReport().

                             {

  return new ELfwkJobReport( *this );

} // clone()
void edm::service::ELfwkJobReport::emitToken ( const ELstring s,
bool  nl = false 
) [protected, virtual]

Definition at line 298 of file ELfwkJobReport.cc.

References benchmark_cfg::cerr, charsOnLine, edm::service::ELdestination::lineLength, and asciidump::s.

Referenced by changeFile(), ELfwkJobReport(), log(), and summarization().

                                                            {

  #ifdef ELfwkJobReport_EMIT_TRACE
    std::cerr << "[][][] in emit:  charsOnLine is " << charsOnLine << '\n';
    std::cerr << "[][][] in emit:  s.length() " << s.length() << '\n';
    std::cerr << "[][][] in emit:  lineLength is " << lineLength << '\n';
  #endif

  if (s.length() == 0)  {
    return;
  }

  #ifdef ELfwkJobReport_EMIT_TRACE
    std::cerr << "[][][] in emit: about to << s to *os: " << s << " \n";
  #endif

  (*os) << s;

  #ifdef ELfwkJobReport_EMIT_TRACE
    std::cerr << "[][][] in emit: completed \n";
  #endif

}  // emitToken()
void edm::service::ELfwkJobReport::finish ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 286 of file ELfwkJobReport.cc.

                              {
  // closing xml tag
  (*os) << "</FrameworkJobReport>\n";
}
void edm::service::ELfwkJobReport::flush ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 407 of file ELfwkJobReport.cc.

References os.

                            {
  os->flush();
}
void edm::service::ELfwkJobReport::includeContext ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 339 of file ELfwkJobReport.cc.

References wantSomeContext.

{ wantSomeContext = true;  }
void edm::service::ELfwkJobReport::includeModule ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 330 of file ELfwkJobReport.cc.

References wantModule.

{ wantModule = true;  }
void edm::service::ELfwkJobReport::includeSerial ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 343 of file ELfwkJobReport.cc.

References wantSerial.

{ wantSerial = true;  }
void edm::service::ELfwkJobReport::includeSubroutine ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 333 of file ELfwkJobReport.cc.

References wantSubroutine.

{ wantSubroutine = true;  }
void edm::service::ELfwkJobReport::includeText ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 336 of file ELfwkJobReport.cc.

References wantText.

{ wantText = true;  }
void edm::service::ELfwkJobReport::includeTime ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 327 of file ELfwkJobReport.cc.

References wantTimestamp.

{ wantTimestamp = true;  }
bool edm::service::ELfwkJobReport::log ( const ErrorObj msg) [virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 198 of file ELfwkJobReport.cc.

References edm::service::ELlimitsTable::add(), benchmark_cfg::cerr, emitToken(), edm::ELextendedID::id, edm::ErrorObj::items(), edm::service::ELdestination::limits, edm::ELextendedID::module, edm::ELextendedID::severity, edm::service::ELdestination::thisShouldBeIgnored(), edm::service::ELdestination::threshold, wantText, xid, and edm::ErrorObj::xid().

                                                   {

  #ifdef ELfwkJobReportTRACE_LOG
    std::cerr << "    =:=:=: Log to an ELfwkJobReport \n";
  #endif

  xid = msg.xid();      // Save the xid.

  // Change log 1:  React ONLY to category FwkJob
  if (xid.id != "FwkJob") return false;
  
  // See if this message is to be acted upon
  // (this is redundant if we are reacting only to FwkJob)
  // and add it to limits table if it was not already present:
  //
  if ( msg.xid().severity < threshold  )  return false;
  
  if ( (xid.id == "BeginningJob")        ||
       (xid.id == "postBeginJob")        ||
       (xid.id == "preEventProcessing")  ||
       (xid.id == "preModule")           ||
       (xid.id == "postModule")          ||
       (xid.id == "postEventProcessing") ||
       (xid.id == "postEndJob")             ) return false; 
  if ( thisShouldBeIgnored(xid.module) )  return false;
  if ( ! limits.add( msg.xid() )       )  return false;

  #ifdef ELfwkJobReportTRACE_LOG
    std::cerr << "    =:=:=: Limits table work done \n";
  #endif

  // Output the prologue:
  //
  //emitToken( "  <Report>\n" );
  //emitToken( "    <Severity> " );
  //emitToken(xid.severity.getSymbol());
  //emitToken(" </Severity>\n");
  //emitToken( "    <Category> ");
  //emitToken(xid.id);
  //emitToken( " </Category>\n");
  //emitToken( "    <Message> \n");
  
 //  emitToken( msg.idOverflow() ); this is how to get the rest of the category

  #ifdef ELfwkJobReportTRACE_LOG
    std::cerr << "    =:=:=: Prologue done \n";
  #endif

  // Output each item in the message:
  //
  if ( wantText )  {
    ELlist_string::const_iterator it;
    for ( it = msg.items().begin();  it != msg.items().end();  ++it )  {
    #ifdef ELfwkJobReportTRACE_LOG
      std::cerr << "      =:=:=: Item:  " << *it << '\n';
    #endif
      //  emitToken( "      <Item> " );
      emitToken( *it);
      emitToken( "\n" );
      //emitToken( " </Item>\n" );
    }
  }

  // Close the body of the message
  //emitToken("    </Message>\n");
  
  // Provide further identification: Module
  //
  //emitToken("    <Module> ");
  //emitToken( xid.module );
  //emitToken(" </Module>\n");    

  #ifdef ELfwkJobReportTRACE_LOG
    std::cerr << "    =:=:=: Module done \n";
  #endif

  // close report
  //
  //emitToken("  </Report>\n\n");

  #ifdef ELfwkJobReportTRACE_LOG
    std::cerr << "  =:=:=: log(msg) done: \n";
  #endif

  return true;

}  // log()
ELfwkJobReport& edm::service::ELfwkJobReport::operator= ( const ELfwkJobReport orig) [protected]
void edm::service::ELfwkJobReport::separateEpilogue ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 351 of file ELfwkJobReport.cc.

References wantEpilogueSeparate.

void edm::service::ELfwkJobReport::separateTime ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 348 of file ELfwkJobReport.cc.

References wantTimeSeparate.

{ wantTimeSeparate = true;  }
void edm::service::ELfwkJobReport::summarization ( const ELstring fullTitle,
const ELstring sumLines 
) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 359 of file ELfwkJobReport.cc.

References emitToken(), geometryCSVtoXML::line, edm::service::ELdestination::lineLength, os, lumiQueryAPI::q, and indexGen::title.

   {
  const int titleMaxLength( 40 );

  // title:
  //
  ELstring title( fullTitle, 0, titleMaxLength );
  int q = (lineLength - title.length() - 2) / 2;
  ELstring line(q, '=');
  emitToken( "", true );
  emitToken( line );
  emitToken( " " );
  emitToken( title );
  emitToken( " " );
  emitToken( line, true );

  // body:
  //
  *os << sumLines;

  // finish:
  //
  emitToken( "", true );
  emitToken( ELstring(lineLength, '='), true );

}  // summarization()
void edm::service::ELfwkJobReport::suppressContext ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 340 of file ELfwkJobReport.cc.

References wantSomeContext.

{ wantSomeContext = false; }
void edm::service::ELfwkJobReport::suppressModule ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 331 of file ELfwkJobReport.cc.

References wantModule.

{ wantModule = false; }
void edm::service::ELfwkJobReport::suppressSerial ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 342 of file ELfwkJobReport.cc.

References wantSerial.

{ wantSerial = false; }
void edm::service::ELfwkJobReport::suppressSubroutine ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 334 of file ELfwkJobReport.cc.

References wantSubroutine.

{ wantSubroutine = false; }
void edm::service::ELfwkJobReport::suppressText ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 337 of file ELfwkJobReport.cc.

References wantText.

{ wantText = false; }
void edm::service::ELfwkJobReport::suppressTime ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 328 of file ELfwkJobReport.cc.

References wantTimestamp.

{ wantTimestamp = false; }
void edm::service::ELfwkJobReport::useContext ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 346 of file ELfwkJobReport.cc.

References wantFullContext.

{ wantFullContext = false; }
void edm::service::ELfwkJobReport::useFullContext ( ) [protected, virtual]

Reimplemented from edm::service::ELdestination.

Definition at line 345 of file ELfwkJobReport.cc.

References wantFullContext.

{ wantFullContext = true;  }

Friends And Related Function Documentation

friend class ELdestControl [friend]

Reimplemented from edm::service::ELdestination.

Definition at line 39 of file ELfwkJobReport.h.


Member Data Documentation

Definition at line 103 of file ELfwkJobReport.h.

Referenced by emitToken().

boost::shared_ptr<std::ostream> edm::service::ELfwkJobReport::os [protected]

Definition at line 102 of file ELfwkJobReport.h.

Referenced by changeFile(), ELfwkJobReport(), flush(), and summarization().

Definition at line 107 of file ELfwkJobReport.h.

Referenced by attachEpilogue(), and separateEpilogue().

Definition at line 107 of file ELfwkJobReport.h.

Referenced by useContext(), and useFullContext().

Definition at line 107 of file ELfwkJobReport.h.

Referenced by includeModule(), and suppressModule().

Definition at line 107 of file ELfwkJobReport.h.

Referenced by includeSerial(), and suppressSerial().

Definition at line 107 of file ELfwkJobReport.h.

Referenced by includeContext(), and suppressContext().

Definition at line 107 of file ELfwkJobReport.h.

Referenced by includeSubroutine(), and suppressSubroutine().

Definition at line 107 of file ELfwkJobReport.h.

Referenced by includeText(), log(), and suppressText().

Definition at line 107 of file ELfwkJobReport.h.

Referenced by attachTime(), and separateTime().

Definition at line 107 of file ELfwkJobReport.h.

Referenced by includeTime(), and suppressTime().

Definition at line 104 of file ELfwkJobReport.h.

Referenced by log().