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