| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

IssueSeverity.cpp
Go to the documentation of this file.
1 #define GAUDIKERNEL_ISSUESEVERITY_CPP 1
2
3 #include "GaudiKernel/IssueSeverity.h"
4 #include "GaudiKernel/StatusCode.h"
5 #include "GaudiKernel/IIssueLogger.h"
6 #include "GaudiKernel/System.h"
7 #include "GaudiKernel/Bootstrap.h"
8 #include "GaudiKernel/ISvcLocator.h"
9
10 #include <sstream>
11
12 bool IssueSeverity::m_init(false);
13 IIssueLogger* IssueSeverity::m_ers(nullptr);
14
15
16 IssueSeverity::~IssueSeverity() {
17 if (!m_reported) {
18 report();
19 // do stuff
20 }
21 }
22
23 void
24 IssueSeverity::report() {
25 if (!m_init) {
26 m_init = true;
27 m_ers = Gaudi::svcLocator()->service<IIssueLogger>("IssueLogger").get();
28 }
29 if (m_ers) {
30 m_ers->report(*this);
31 } else {
32 std::cerr << *this << std::endl;
33 }
34 m_reported = true;
35 }
36
37 std::string
38 IssueSeverity::getOrigin() const {
39 return m_file + ":" + std::to_string(m_line);
40 }
41
System.h
IssueSeverity::m_init
static bool m_init
Definition: IssueSeverity.h:100
IssueSeverity::m_ers
static IIssueLogger * m_ers
Definition: IssueSeverity.h:101
IssueSeverity::report
void report()
Definition: IssueSeverity.cpp:24
IssueSeverity::getOrigin
std::string getOrigin() const
Definition: IssueSeverity.cpp:38
IIssueLogger::report
virtual void report(IssueSeverity::Level level, const std::string &msg, const std::string &origin)=0
std::to_string
T to_string(T...args)
IssueSeverity::~IssueSeverity
~IssueSeverity()
Definition: IssueSeverity.cpp:16
std::endl
T endl(T...args)
Bootstrap.h
IIssueLogger
Definition: IIssueLogger.h:9
IssueSeverity::m_file
std::string m_file
Definition: IssueSeverity.h:93
std::string
STL class.
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
Gaudi::svcLocator
GAUDI_API ISvcLocator * svcLocator()
IIssueLogger.h
IssueSeverity.h
IssueSeverity::m_line
int m_line
Definition: IssueSeverity.h:96
StatusCode.h
std::cerr
ISvcLocator.h
IssueSeverity::m_reported
bool m_reported
Definition: IssueSeverity.h:98