The Gaudi Framework  master (37c0b60a)
LoggingAuditor.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #include <GaudiKernel/Auditor.h>
12 #include <GaudiKernel/MsgStream.h>
13 
14 // ============================================================================
22 namespace GaudiTestSuite {
23 
24  class LoggingAuditor : public Auditor {
25  public:
27  using Auditor::Auditor;
28 
29  void before( StandardEventType evt, INamedInterface* caller ) override {
30  auto& log = info();
31  log << "Auditing before of " << evt;
32  if ( caller ) log << " for " << caller->name();
33  log << endmsg;
34  }
35 
36  void after( StandardEventType evt, INamedInterface* caller, const StatusCode& ) override {
37  auto& log = info();
38  log << "Auditing after of " << evt;
39  if ( caller ) log << " for " << caller->name();
40  log << endmsg;
41  }
42 
43  void before( CustomEventTypeRef evt, INamedInterface* caller ) override {
44  auto& log = info();
45  log << "Auditing before of " << evt;
46  if ( caller ) log << " for " << caller->name();
47  log << endmsg;
48  }
49 
50  void after( CustomEventTypeRef evt, INamedInterface* caller, const StatusCode& ) override {
51  auto& log = info();
52  log << "Auditing after of " << evt;
53  if ( caller ) log << " for " << caller->name();
54  log << endmsg;
55  }
56 
57  void before( StandardEventType evt, const std::string& caller ) override {
58  info() << "Auditing before of " << evt << " for " << caller << endmsg;
59  }
60 
61  void after( StandardEventType evt, const std::string& caller, const StatusCode& ) override {
62  info() << "Auditing after of " << evt << " for " << caller << endmsg;
63  }
64 
65  void before( CustomEventTypeRef evt, const std::string& caller ) override {
66  info() << "Auditing before of " << evt << " for " << caller << endmsg;
67  }
68 
69  void after( CustomEventTypeRef evt, const std::string& caller, const StatusCode& ) override {
70  info() << "Auditing after of " << evt << " for " << caller << endmsg;
71  }
72  };
73 
75 } // namespace GaudiTestSuite
76 
77 namespace GaudiExamples {
79  using GaudiTestSuite::LoggingAuditor::LoggingAuditor;
80  };
82 } // namespace GaudiExamples
IOTest.evt
evt
Definition: IOTest.py:107
GaudiTestSuite::LoggingAuditor::before
void before(StandardEventType evt, INamedInterface *caller) override
Definition: LoggingAuditor.cpp:29
std::string
STL class.
Gaudi.Configuration.log
log
Definition: Configuration.py:28
GaudiTestSuite::LoggingAuditor::before
void before(CustomEventTypeRef evt, INamedInterface *caller) override
Definition: LoggingAuditor.cpp:43
GaudiTestSuite::LoggingAuditor::after
void after(StandardEventType evt, const std::string &caller, const StatusCode &) override
Definition: LoggingAuditor.cpp:61
GaudiTestSuite::LoggingAuditor::after
void after(CustomEventTypeRef evt, const std::string &caller, const StatusCode &) override
Definition: LoggingAuditor.cpp:69
INamedInterface::name
virtual const std::string & name() const =0
Retrieve the name of the instance.
GaudiTestSuite::LoggingAuditor::before
void before(CustomEventTypeRef evt, const std::string &caller) override
Definition: LoggingAuditor.cpp:65
GaudiExamples
Definition: LoggingAuditor.cpp:77
LoggingAuditor
Auditor
Definition: Auditor.h:43
StatusCode
Definition: StatusCode.h:65
GaudiExamples::LoggingAuditor
Definition: LoggingAuditor.cpp:78
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
GaudiTestSuite::LoggingAuditor
Definition: LoggingAuditor.cpp:24
INamedInterface
Definition: INamedInterface.h:25
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginServiceV1.h:46
Auditor::Auditor
Auditor(std::string name, ISvcLocator *svcloc)
Constructor.
Definition: Auditor.cpp:21
GaudiTestSuite::LoggingAuditor::after
void after(CustomEventTypeRef evt, INamedInterface *caller, const StatusCode &) override
Definition: LoggingAuditor.cpp:50
GaudiTestSuite::LoggingAuditor::before
void before(StandardEventType evt, const std::string &caller) override
Definition: LoggingAuditor.cpp:57
GaudiTestSuite::LoggingAuditor::after
void after(StandardEventType evt, INamedInterface *caller, const StatusCode &) override
Definition: LoggingAuditor.cpp:36
GaudiTestSuite
Definition: LoggingAuditor.cpp:22
MsgStream.h
Auditor.h