34 bool Emit(
const RLogEntry &entry)
override;
37inline bool RLogHandlerDefault::Emit(
const RLogEntry &entry)
40 int cappedLevel = std::min(
static_cast<int>(entry.
fLevel), numLevels - 1);
41 constexpr static std::array<const char *, numLevels> sTag{
42 {
"{unset-error-level please report}",
"FATAL",
"Error",
"Warning",
"Info",
"Debug"}};
44 std::stringstream strm;
46 if (channel && !channel->GetName().empty())
47 strm <<
'[' << channel->
GetName() <<
"] ";
48 strm << sTag[cappedLevel];
70 auto iter = std::find_if(
fHandlers.begin(),
fHandlers.end(), [&](
const std::unique_ptr<RLogHandler> &handlerPtr) {
71 return handlerPtr.get() == handler;
74 std::unique_ptr<RLogHandler> ret;
88 channel->Increment(entry.
fLevel);
92 if (channel->GetEffectiveVerbosity(*
this) < entry.
fLevel)
97 std::vector<RLogHandler *> handlers;
100 std::lock_guard<std::mutex> lock(
fMutex);
104 [](
const std::unique_ptr<RLogHandler> &handlerUPtr) { return handlerUPtr.get(); });
107 for (
auto &&handler : handlers)
108 if (!handler->Emit(entry))
static Roo_reg_AGKInteg1D instance
ErrorHandlerFunc_t GetErrorHandler()
Returns the current error handler function.
const std::string & GetName() const
void Increment(ELogLevel severity)
Increase warning or error count.
A diagnostic that can be emitted by the RLogManager.
Abstract RLogHandler base class.
A RLogHandler that multiplexes diagnostics to different client RLogHandlers and keeps track of the su...
std::list< std::unique_ptr< RLogHandler > > fHandlers
std::unique_ptr< RLogHandler > Remove(RLogHandler *handler)
Remove and return the given log handler. Returns nullptr if not found.
static RLogManager & Get()
bool Emit(const RLogEntry &entry) override
Emit a log entry.
@ 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.