ROOT
v6-20
Reference Guide
RLogger.cxx
Go to the documentation of this file.
1
/// \file TLogger.cxx
2
/// \ingroup Base ROOT7
3
/// \author Axel Naumann <axel@cern.ch>
4
/// \date 2015-07-07
5
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6
/// is welcome!
7
8
/*************************************************************************
9
* Copyright (C) 1995-2015, Rene Brun and Fons Rademakers. *
10
* All rights reserved. *
11
* *
12
* For the licensing terms see $ROOTSYS/LICENSE. *
13
* For the list of contributors see $ROOTSYS/README/CREDITS. *
14
*************************************************************************/
15
16
#include "
ROOT/RLogger.hxx
"
17
#include <iostream>
18
#include <sstream>
19
20
#include "
TError.h
"
21
22
// pin vtable
23
ROOT::Experimental::RLogHandler::~RLogHandler
() {}
24
25
namespace
{
26
class
RLogHandlerDefault:
public
ROOT::Experimental::RLogHandler
{
27
public
:
28
// Returns false if further emission of this log entry should be suppressed.
29
bool
Emit(
const
ROOT::Experimental::RLogEntry
&entry)
override
;
30
};
31
32
bool
RLogHandlerDefault::Emit(
const
ROOT::Experimental::RLogEntry
&entry)
33
{
34
constexpr
static
std::array<const char *, 5> sTag{{
"Debug"
,
"Info"
,
"Warning"
,
"Log"
,
"FATAL"
}};
35
std::stringstream strm;
36
strm <<
"ROOT "
;
37
if
(!entry.
fGroup
.empty())
38
strm <<
'['
<< entry.
fGroup
<<
"] "
;
39
strm << sTag[static_cast<int>(entry.
fLevel
)];
40
41
if
(!entry.
fFile
.empty())
42
strm <<
" "
<< entry.
fFile
<<
':'
<< entry.
fLine
;
43
if
(!entry.
fFuncName
.empty())
44
strm <<
" in "
<< entry.
fFuncName
;
45
46
static
constexpr
const
int
errorLevelOld[] = {0, 1000, 2000, 3000, 6000};
47
(*
::GetErrorHandler
())(errorLevelOld[
static_cast<
int
>
(entry.
fLevel
)],
48
entry.
fLevel
==
ROOT::Experimental::ELogLevel::kFatal
,
49
strm.str().c_str(), entry.str().c_str());
50
return
true
;
51
}
52
}
// unnamed namespace
53
54
ROOT::Experimental::RLogManager
&
ROOT::Experimental::RLogManager::Get
()
55
{
56
static
RLogManager
instance
(std::make_unique<RLogHandlerDefault>());
57
return
instance
;
58
}
RLogger.hxx
TError.h
GetErrorHandler
ErrorHandlerFunc_t GetErrorHandler()
Returns the current error handler function.
Definition:
TError.cxx:116
ROOT::Experimental::RLogEntry
A diagnostic, emitted by the RLogManager upon destruction of the RLogEntry.
Definition:
RLogger.hxx:136
ROOT::Experimental::RLogEntry::fGroup
std::string fGroup
Definition:
RLogger.hxx:138
ROOT::Experimental::RLogEntry::fFuncName
std::string fFuncName
Definition:
RLogger.hxx:140
ROOT::Experimental::RLogEntry::fFile
std::string fFile
Definition:
RLogger.hxx:139
ROOT::Experimental::RLogEntry::fLevel
ELogLevel fLevel
Definition:
RLogger.hxx:142
ROOT::Experimental::RLogEntry::fLine
int fLine
Definition:
RLogger.hxx:141
ROOT::Experimental::RLogHandler
Abstract RLogHandler base class.
Definition:
RLogger.hxx:46
ROOT::Experimental::RLogHandler::~RLogHandler
virtual ~RLogHandler()
Definition:
RLogger.cxx:23
ROOT::Experimental::RLogManager
A RLogHandler that multiplexes diagnostics to different client RLogHandlers.
Definition:
RLogger.hxx:64
ROOT::Experimental::RLogManager::Get
static RLogManager & Get()
Definition:
RLogger.cxx:54
ROOT::Experimental::ELogLevel::kFatal
@ kFatal
RooFit_internal::instance
static Roo_reg_AGKInteg1D instance
Definition:
RooAdaptiveGaussKronrodIntegrator1D.cxx:153
core
base
v7
src
RLogger.cxx
ROOT v6-20 - Reference Guide Generated on Fri Apr 1 2022 00:19:44 (GVA Time) using Doxygen 1.9.4