All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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);
14 
15 
17  if (!m_reported) {
18  report();
19  // do stuff
20  }
21 }
22 
23 void
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
39  return m_file + ":" + std::to_string(m_line);
40 }
41 
string to_string(const T &value)
Definition: mergesort.cpp:40
std::string getOrigin() const
virtual void report(IssueSeverity::Level level, const std::string &msg, const std::string &origin)=0
std::string m_file
Definition: IssueSeverity.h:93
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_API ISvcLocator * svcLocator()
static IIssueLogger * m_ers
static bool m_init