mirror of
https://github.com/FairRootGroup/FairLogger.git
synced 2025-10-13 00:31:12 +00:00
Fixes for the updated severity order
This commit is contained in:
parent
cfe0f9dc53
commit
a0ff4eba50
|
@ -112,17 +112,17 @@ const array<string, 12> Logger::fSeverityNames =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
"NOLOG",
|
"NOLOG",
|
||||||
"FATAL",
|
"TRACE",
|
||||||
"ERROR",
|
|
||||||
"WARN",
|
|
||||||
"STATE",
|
|
||||||
"INFO",
|
|
||||||
"DEBUG",
|
|
||||||
"DEBUG1",
|
|
||||||
"DEBUG2",
|
|
||||||
"DEBUG3",
|
|
||||||
"DEBUG4",
|
"DEBUG4",
|
||||||
"TRACE"
|
"DEBUG3",
|
||||||
|
"DEBUG2",
|
||||||
|
"DEBUG1",
|
||||||
|
"DEBUG",
|
||||||
|
"INFO",
|
||||||
|
"STATE",
|
||||||
|
"WARN",
|
||||||
|
"ERROR",
|
||||||
|
"FATAL"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -425,25 +425,26 @@ void Logger::CycleVerbosityDown()
|
||||||
|
|
||||||
void Logger::UpdateMinSeverity()
|
void Logger::UpdateMinSeverity()
|
||||||
{
|
{
|
||||||
fMinSeverity = (fConsoleSeverity <= fFileSeverity) ? fFileSeverity : fConsoleSeverity;
|
if (fFileSeverity == Severity::nolog) {
|
||||||
|
fMinSeverity = fConsoleSeverity;
|
||||||
|
} else {
|
||||||
|
fMinSeverity = std::min(fConsoleSeverity, fFileSeverity);
|
||||||
|
}
|
||||||
|
|
||||||
for (auto& it : fCustomSinks) {
|
for (auto& it : fCustomSinks) {
|
||||||
if (fMinSeverity <= it.second.first) {
|
if (fMinSeverity == Severity::nolog) {
|
||||||
fMinSeverity = it.second.first;
|
fMinSeverity = std::max(fMinSeverity, it.second.first);
|
||||||
|
} else if (it.second.first != Severity::nolog) {
|
||||||
|
fMinSeverity = std::min(fMinSeverity, it.second.first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Logger::Logging(Severity severity)
|
bool Logger::Logging(Severity severity)
|
||||||
{
|
{
|
||||||
if (Severity::fatal == severity) {
|
return (severity >= fMinSeverity &&
|
||||||
return true;
|
fMinSeverity > Severity::nolog) ||
|
||||||
}
|
severity == Severity::fatal;
|
||||||
if (severity <= fMinSeverity && severity > Severity::nolog) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Logger::Logging(const string& severityStr)
|
bool Logger::Logging(const string& severityStr)
|
||||||
|
@ -548,22 +549,22 @@ void Logger::RemoveFileSink()
|
||||||
|
|
||||||
bool Logger::LoggingToConsole() const
|
bool Logger::LoggingToConsole() const
|
||||||
{
|
{
|
||||||
return (fInfos.severity <= fConsoleSeverity &&
|
return (fInfos.severity >= fConsoleSeverity &&
|
||||||
fInfos.severity > Severity::nolog) ||
|
fConsoleSeverity > Severity::nolog) ||
|
||||||
fInfos.severity == Severity::fatal;
|
fInfos.severity == Severity::fatal;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Logger::LoggingToFile() const
|
bool Logger::LoggingToFile() const
|
||||||
{
|
{
|
||||||
return (fInfos.severity <= fFileSeverity &&
|
return (fInfos.severity >= fFileSeverity &&
|
||||||
fInfos.severity > Severity::nolog) ||
|
fFileSeverity > Severity::nolog) ||
|
||||||
fInfos.severity == Severity::fatal;
|
fInfos.severity == Severity::fatal;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Logger::LoggingCustom(const Severity severity) const
|
bool Logger::LoggingCustom(const Severity severity) const
|
||||||
{
|
{
|
||||||
return (fInfos.severity <= severity &&
|
return (fInfos.severity >= severity &&
|
||||||
fInfos.severity > Severity::nolog) ||
|
severity > Severity::nolog) ||
|
||||||
fInfos.severity == Severity::fatal;
|
fInfos.severity == Severity::fatal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,32 +51,32 @@ namespace fair
|
||||||
enum class Severity : int
|
enum class Severity : int
|
||||||
{
|
{
|
||||||
nolog = 0,
|
nolog = 0,
|
||||||
fatal = 11,
|
|
||||||
error = 10,
|
|
||||||
warn = 9,
|
|
||||||
state = 8,
|
|
||||||
info = 7,
|
|
||||||
debug = 6,
|
|
||||||
debug1 = 5,
|
|
||||||
debug2 = 4,
|
|
||||||
debug3 = 3,
|
|
||||||
debug4 = 2,
|
|
||||||
trace = 1,
|
trace = 1,
|
||||||
|
debug4 = 2,
|
||||||
|
debug3 = 3,
|
||||||
|
debug2 = 4,
|
||||||
|
debug1 = 5,
|
||||||
|
debug = 6,
|
||||||
|
info = 7,
|
||||||
|
state = 8,
|
||||||
|
warn = 9,
|
||||||
|
error = 10,
|
||||||
|
fatal = 11,
|
||||||
// backwards-compatibility:
|
// backwards-compatibility:
|
||||||
NOLOG = nolog,
|
NOLOG = nolog,
|
||||||
FATAL = fatal,
|
TRACE = trace,
|
||||||
ERROR = error,
|
|
||||||
WARN = warn,
|
|
||||||
warning = warn,
|
|
||||||
WARNING = warn,
|
|
||||||
STATE = state,
|
|
||||||
INFO = info,
|
|
||||||
DEBUG = debug,
|
|
||||||
DEBUG1 = debug1,
|
|
||||||
DEBUG2 = debug2,
|
|
||||||
DEBUG3 = debug3,
|
|
||||||
DEBUG4 = debug4,
|
DEBUG4 = debug4,
|
||||||
TRACE = trace
|
DEBUG3 = debug3,
|
||||||
|
DEBUG2 = debug2,
|
||||||
|
DEBUG1 = debug1,
|
||||||
|
DEBUG = debug,
|
||||||
|
INFO = info,
|
||||||
|
STATE = state,
|
||||||
|
WARNING = warn,
|
||||||
|
warning = warn,
|
||||||
|
WARN = warn,
|
||||||
|
ERROR = error,
|
||||||
|
FATAL = fatal
|
||||||
};
|
};
|
||||||
|
|
||||||
// verbosity levels:
|
// verbosity levels:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user