| # Gaudi Framework, version v20r4
Generated: 8 Jan 2009

# NameAuditor.cpp

Go to the documentation of this file.

    00001 // NameAuditor:
    00002 //  An auditor that prints the name of each algorithm method before
    00003 // and after it is called///
    00004
    00005 #include "NameAuditor.h"
    00006
    00007 #include "GaudiKernel/MsgStream.h"
    00008 #include "GaudiKernel/INamedInterface.h"
    00009 #include "GaudiKernel/AudFactory.h"
    00010
    00011 #include <sstream>
    00012
    00013 DECLARE_AUDITOR_FACTORY(NameAuditor);
    00014
    00015 NameAuditor::NameAuditor(const std::string& name, ISvcLocator* pSvcLocator) :
    00016   Auditor(name, pSvcLocator)
    00017 {
    00018
    00019   declareProperty("CustomEventTypes", m_types,
    00020                   "List of custom event types to audit ([]=all, ['none']=none");
    00021
    00022 }
    00023
    00024 NameAuditor::~NameAuditor(){
    00025 }
    00026
    00027
    00028 void NameAuditor::before(StandardEventType evt, const std::string& caller)
    00029 {
    00030   std::ostringstream oss;
    00031   oss << evt;
    00032   before(oss.str(), caller);
    00033 }
    00034
    00035
    00036 void NameAuditor::after(StandardEventType evt, const std::string& caller, const StatusCode& sc)
    00037 {
    00038   std::ostringstream oss;
    00039   oss << evt;
    00040   after(oss.str(), caller, sc);
    00041 }
    00042
    00043 void
    00044 NameAuditor::i_doAudit(const std::string& evt, const std::string& caller, Action action)
    00045 {
    00046   if (m_types.value().size() != 0) {
    00047     if ( (m_types.value())[0] == "none") {
    00048       return;
    00049     }
    00050
    00051     if ( find(m_types.value().begin(), m_types.value().end(), evt) ==
    00052          m_types.value().end() ) {
    00053       return;
    00054     }
    00055   }
    00056
    00057   MsgStream log( msgSvc(), name() );
    00058   if ( action==BEFORE ) {
    00059     log << MSG::INFO << "About to Enter " << caller << " with auditor trigger "
    00060         << evt << endreq;
    00061   }
    00062   else {
    00063     log << MSG::INFO << "Just Exited " << caller << " with auditor trigger "
    00064         << evt << endreq;
    00065   }
    00066 }