ROOT
6.10/09
Reference Guide
core
base
v7
src
TLogger.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 is welcome!
6
7
/*************************************************************************
8
* Copyright (C) 1995-2015, Rene Brun and Fons Rademakers. *
9
* All rights reserved. *
10
* *
11
* For the licensing terms see $ROOTSYS/LICENSE. *
12
* For the list of contributors see $ROOTSYS/README/CREDITS. *
13
*************************************************************************/
14
15
#include "
ROOT/TLogger.hxx
"
16
#include <iostream>
17
18
// pin vtable
19
ROOT::Experimental::TLogHandler::~TLogHandler
() {}
20
21
namespace
{
22
class
TLogHandlerDefault:
public
ROOT::Experimental::TLogHandler
{
23
public
:
24
// Returns false if further emission of this log entry should be suppressed.
25
bool
Emit
(
const
ROOT::Experimental::TLogEntry
&entry)
override
;
26
};
27
28
bool
TLogHandlerDefault::Emit(
const
ROOT::Experimental::TLogEntry
&entry) {
29
constexpr
static
std::array<const char *, 5> sTag{
30
{
"Debug"
,
31
"Info"
,
32
"Warning"
,
33
"Log"
,
34
"FATAL"
}
35
};
36
std::cerr <<
"ROOT "
;
37
if
(!entry.
fGroup
.empty())
38
std::cerr <<
'['
<< entry.
fGroup
<<
"] "
;
39
std::cerr << sTag[static_cast<int>(entry.
fLevel
)];
40
41
if
(!entry.
fFile
.empty())
42
std::cerr <<
" "
<< entry.
fFile
<<
':'
<< entry.
fLine
;
43
if (!entry.
fFuncName
.empty())
44
std::cerr <<
" in "
<< entry.
fFuncName
;
45
std::cerr <<
":\n"
<<
" "
<< entry.str();
46
return
true
;
47
}
48
}
// unnamed namespace
49
50
ROOT::Experimental::TLogManager
&
ROOT::Experimental::TLogManager::Get
() {
51
static
TLogManager
instance(std::make_unique<TLogHandlerDefault>());
52
return
instance;
53
}
ROOT::Experimental::TLogEntry::fFuncName
std::string fFuncName
Definition:
TLogger.hxx:90
ROOT::Experimental::TLogHandler::Emit
virtual bool Emit(const TLogEntry &entry)=0
ROOT::Experimental::TLogHandler::~TLogHandler
virtual ~TLogHandler()
Definition:
TLogger.cxx:19
ROOT::Experimental::TLogEntry::fFile
std::string fFile
Definition:
TLogger.hxx:89
TLogger.hxx
ROOT::Experimental::TLogManager
Definition:
TLogger.hxx:53
ROOT::Experimental::TLogEntry
Definition:
TLogger.hxx:86
ROOT::Experimental::TLogManager::Get
static TLogManager & Get()
Definition:
TLogger.cxx:50
ROOT::Experimental::TLogEntry::fLine
int fLine
Definition:
TLogger.hxx:91
ROOT::Experimental::TLogHandler
Abstract TLogHandler base class.
Definition:
TLogger.hxx:45
ROOT::Experimental::TLogEntry::fLevel
ELogLevel fLevel
Definition:
TLogger.hxx:92
ROOT::Experimental::TLogEntry::fGroup
std::string fGroup
Definition:
TLogger.hxx:88