43 return static_cast<ELogLevel>(
static_cast<int>(severity) + offset);
146 void PushFront(std::unique_ptr<RLogHandler> handler) {
fHandlers.emplace_front(std::move(handler)); }
149 void PushBack(std::unique_ptr<RLogHandler> handler) {
fHandlers.emplace_back(std::move(handler)); }
216 const std::string &funcname)
217 :
fEntry(level, channel, {filename, funcname,
line})
319#define R__LOG_PRETTY_FUNCTION __FUNCSIG__
321#define R__LOG_PRETTY_FUNCTION __PRETTY_FUNCTION__
339#define R__LOG_TO_CHANNEL(SEVERITY, CHANNEL) \
340 ((SEVERITY < ROOT::ELogLevel::kInfo + 0) || \
341 ROOT::Internal::GetChannelOrManager(CHANNEL).GetEffectiveVerbosity(ROOT::RLogManager::Get()) >= SEVERITY) && \
342 ROOT::Detail::RLogBuilder(SEVERITY, ROOT::Internal::GetChannelOrManager(CHANNEL), __FILE__, __LINE__, \
343 R__LOG_PRETTY_FUNCTION)
355#define R__LOG_FATAL(...) R__LOG_TO_CHANNEL(ROOT::ELogLevel::kFatal, __VA_ARGS__)
356#define R__LOG_ERROR(...) R__LOG_TO_CHANNEL(ROOT::ELogLevel::kError, __VA_ARGS__)
357#define R__LOG_WARNING(...) R__LOG_TO_CHANNEL(ROOT::ELogLevel::kWarning, __VA_ARGS__)
358#define R__LOG_INFO(...) R__LOG_TO_CHANNEL(ROOT::ELogLevel::kInfo, __VA_ARGS__)
359#define R__LOG_DEBUG(DEBUGLEVEL, ...) R__LOG_TO_CHANNEL(ROOT::ELogLevel::kDebug + DEBUGLEVEL, __VA_ARGS__)
RLogBuilder(ELogLevel level, RLogChannel &channel)
RLogBuilder(ELogLevel level, RLogChannel &channel, const std::string &filename, int line, const std::string &funcname)
RLogEntry fEntry
The log entry to be built.
~RLogBuilder()
Emit the log entry through the static log manager.
A log configuration for a channel, e.g.
std::string fName
Name as shown in diagnostics.
RLogChannel(ELogLevel verbosity)
Construct an anonymous channel with a default verbosity.
const std::string & GetName() const
ELogLevel fVerbosity
Verbosity of this channel. By default, use the global verbosity.
RLogChannel()=default
Construct an anonymous channel.
ELogLevel GetVerbosity() const
ELogLevel SetVerbosity(ELogLevel verbosity)
RLogChannel(const std::string &name)
Construct a log channel given its name, which is part of the diagnostics.
ELogLevel GetEffectiveVerbosity(const RLogManager &mgr) const
Keep track of emitted errors and warnings.
long long GetNumFatalErrors() const
Returns the current number of fatal errors.
void Increment(ELogLevel severity)
Increase warning or error count.
std::atomic< long long > fNumWarnings
std::atomic< long long > fNumFatalErrors
Number of errors.
std::atomic< long long > fNumErrors
Number of warnings.
long long GetNumWarnings() const
Number of fatal errors.
long long GetNumErrors() const
Returns the current number of errors.
A diagnostic that can be emitted by the RLogManager.
RLogEntry(ELogLevel level, RLogChannel &channel)
RLogEntry(ELogLevel level, RLogChannel &channel, const RLogLocation &loc)
Abstract RLogHandler base class.
virtual bool Emit(const RLogEntry &entry)=0
Emit a log entry.
A RLogHandler that multiplexes diagnostics to different client RLogHandlers and keeps track of the su...
std::list< std::unique_ptr< RLogHandler > > fHandlers
void PushBack(std::unique_ptr< RLogHandler > handler)
Add a RLogHandler in the back - to be called after all others.
RLogManager(std::unique_ptr< RLogHandler > lh)
Initialize taking a RLogHandler.
std::unique_ptr< RLogHandler > Remove(RLogHandler *handler)
Remove and return the given log handler. Returns nullptr if not found.
bool Emit(const RLogEntry &entry) override
Emit a log entry.
void PushFront(std::unique_ptr< RLogHandler > handler)
Add a RLogHandler in the front - to be called before all others.
static RLogManager & Get()
bool HasWarningOccurred() const
Whether the RLogDiagCount has emitted a warnings since construction time of *this.
bool HasErrorOccurred() const
Whether the RLogDiagCount has emitted an error (fatal or not) since construction time of *this.
RLogScopedDiagCount(RLogDiagCount &cnt)
Construct the scoped count given a counter (e.g.
long long GetAccumulatedFatalErrors() const
Get the number of errors that the RLogDiagCount has emitted since construction of *this.
long long GetAccumulatedWarnings() const
Get the number of warnings that the RLogDiagCount has emitted since construction of *this.
long long fInitialErrors
The number of the RLogDiagCount's emitted errors at construction time.
long long GetAccumulatedErrors() const
Get the number of errors that the RLogDiagCount has emitted since construction of *this.
bool HasErrorOrWarningOccurred() const
Whether the RLogDiagCount has emitted an error or a warning since construction time of *this.
long long fInitialWarnings
The number of the RLogDiagCount's emitted warnings at construction time of *this.
long long fInitialFatalErrors
The number of the RLogDiagCount's emitted fatal errors at construction time.
RLogScopedDiagCount()
Construct the scoped count for any diagnostic, whatever its channel.
RLogScopedVerbosity(ELogLevel verbosity)
RLogScopedVerbosity(RLogChannel &channel, ELogLevel verbosity)
RLogChannel & GetChannelOrManager()
ELogLevel
Kinds of diagnostics.
@ kInfo
Informational messages; used for instance for tracing.
@ kDebug
Debug information; only useful for developers; can have added verbosity up to 255-kDebug.
@ kFatal
An error which causes further processing to be unreliable.
@ kWarning
Warnings about likely unexpected behavior.
ELogLevel operator+(ELogLevel severity, int offset)
A diagnostic location, part of an RLogEntry.