26 namespace Experimental {
54 virtual bool Emit(
const TLogEntry &entry) = 0;
65 std::vector<std::unique_ptr<TLogHandler>>
fHandlers;
67 long long fNumWarnings{0};
68 long long fNumErrors{0};
71 TLogManager(std::unique_ptr<TLogHandler> &&lh) { fHandlers.emplace_back(std::move(lh)); }
77 void PushFront(std::unique_ptr<TLogHandler> handler) { fHandlers.insert(fHandlers.begin(), std::move(handler)); }
80 void PushBack(std::unique_ptr<TLogHandler> handler) { fHandlers.emplace_back(std::move(handler)); }
86 for (
auto &&handler: fHandlers)
87 if (!handler->Emit(entry))
147 : fGroup(group), fFile(filename), fFuncName(funcname), fLine(line), fLevel(level)
172 #if defined(_MSC_VER) 173 #define R__LOG_PRETTY_FUNCTION __FUNCSIG__ 175 #define R__LOG_PRETTY_FUNCTION __PRETTY_FUNCTION__ 178 #define R__LOG_HERE(LEVEL, GROUP) \ 179 ROOT::Experimental::TLogEntry(LEVEL, GROUP).SetFile(__FILE__).SetLine(__LINE__).SetFunction(R__LOG_PRETTY_FUNCTION) 181 #define R__FATAL_HERE(GROUP) R__LOG_HERE(ROOT::Experimental::ELogLevel::kFatal, GROUP) 182 #define R__ERROR_HERE(GROUP) R__LOG_HERE(ROOT::Experimental::ELogLevel::kError, GROUP) 183 #define R__WARNING_HERE(GROUP) R__LOG_HERE(ROOT::Experimental::ELogLevel::kWarning, GROUP) 184 #define R__INFO_HERE(GROUP) R__LOG_HERE(ROOT::Experimental::ELogLevel::kInfo, GROUP) 185 #define R__DEBUG_HERE(GROUP) R__LOG_HERE(ROOT::Experimental::ELogLevel::kDebug, GROUP) TLogEntry & SetLine(int line)
Namespace for new ROOT classes and functions.
TLogEntry(ELogLevel level, std::string_view group)
void PushBack(std::unique_ptr< TLogHandler > handler)
Add a TLogHandler in the back - to be called after all others.
long long GetNumWarnings() const
Returns the current number of warnings seen by this log manager.
long long GetAccumulatedWarnings() const
Get the number of warnings that the TLogManager has emitted since construction of *this...
void PushFront(std::unique_ptr< TLogHandler > handler)
Add a TLogHandler in the front - to be called before all others.
TLogEntry(ELogLevel level, std::string_view group, std::string_view filename, int line, std::string_view funcname)
bool Emit(const TLogEntry &entry) override
Emit a log entry.
TLogEntry & SetFile(const std::string &file)
TLogManager(std::unique_ptr< TLogHandler > &&lh)
Initialize taking a TLogHandlerDefault.
bool HasErrorOrWarningOccurred() const
Whether the TLogManager has emitted an error or a warning since construction time of *this...
Informational messages; used for instance for tracing.
A TLogHandler that multiplexes diagnostics to different client TLogHandlers.
A diagnostic, emitted by the TLogManager upon destruction of the TLogEntry.
static TLogManager & Get()
std::vector< std::unique_ptr< TLogHandler > > fHandlers
Warnings about likely unexpected behavior.
Object to count the number of warnings and errors emitted by a section of code, after construction of...
Abstract TLogHandler base class.
long long GetAccumulatedErrors() const
Get the number of errors that the TLogManager has emitted since construction of *this.
basic_string_view< char > string_view
bool HasErrorOccurred() const
Whether the TLogManager has emitted an error since construction time of *this.
TLogEntry & SetFunction(const std::string &func)
Debug information; only useful for developers.
ELogLevel
Kinds of diagnostics.
long long GetNumErrors() const
Returns the current number of errors seen by this log manager.
bool HasWarningOccurred() const
Whether the TLogManager has emitted a warnings since construction time of *this.