mirror of
https://github.com/FairRootGroup/FairLogger.git
synced 2025-10-13 00:31:12 +00:00
Add critical severity level between fatal and error
This commit is contained in:
parent
0ae9a697b4
commit
b9469b8a26
|
@ -100,6 +100,7 @@ where severity level is one of the following:
|
||||||
"important",
|
"important",
|
||||||
"alarm",
|
"alarm",
|
||||||
"error",
|
"error",
|
||||||
|
"critical",
|
||||||
"fatal",
|
"fatal",
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
* Copyright (C) 2014-2025 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
||||||
* *
|
* *
|
||||||
* This software is distributed under the terms of the *
|
* This software is distributed under the terms of the *
|
||||||
* GNU Lesser General Public Licence (LGPL) version 3, *
|
* GNU Lesser General Public Licence (LGPL) version 3, *
|
||||||
|
@ -69,6 +69,7 @@ const unordered_map<string_view, Severity> Logger::fSeverityMap =
|
||||||
{ {"NOLOG"}, Severity::nolog },
|
{ {"NOLOG"}, Severity::nolog },
|
||||||
{ {"fatal"}, Severity::fatal },
|
{ {"fatal"}, Severity::fatal },
|
||||||
{ {"FATAL"}, Severity::fatal },
|
{ {"FATAL"}, Severity::fatal },
|
||||||
|
{ {"critical"}, Severity::critical },
|
||||||
{ {"error"}, Severity::error },
|
{ {"error"}, Severity::error },
|
||||||
{ {"ERROR"}, Severity::error },
|
{ {"ERROR"}, Severity::error },
|
||||||
{ {"alarm"}, Severity::alarm },
|
{ {"alarm"}, Severity::alarm },
|
||||||
|
@ -96,7 +97,7 @@ const unordered_map<string_view, Severity> Logger::fSeverityMap =
|
||||||
{ {"TRACE"}, Severity::trace }
|
{ {"TRACE"}, Severity::trace }
|
||||||
};
|
};
|
||||||
|
|
||||||
const array<string_view, 15> Logger::fSeverityNames =
|
const array<string_view, 16> Logger::fSeverityNames =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
"NOLOG",
|
"NOLOG",
|
||||||
|
@ -113,6 +114,7 @@ const array<string_view, 15> Logger::fSeverityNames =
|
||||||
"IMPORTANT",
|
"IMPORTANT",
|
||||||
"ALARM",
|
"ALARM",
|
||||||
"ERROR",
|
"ERROR",
|
||||||
|
"CRITICAL",
|
||||||
"FATAL"
|
"FATAL"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -289,6 +291,7 @@ string Logger::GetColoredSeverityString(Severity severity)
|
||||||
switch (severity) {
|
switch (severity) {
|
||||||
case Severity::nolog: return "\033[01;39mNOLOG\033[0m"; break;
|
case Severity::nolog: return "\033[01;39mNOLOG\033[0m"; break;
|
||||||
case Severity::fatal: return "\033[01;31mFATAL\033[0m"; break;
|
case Severity::fatal: return "\033[01;31mFATAL\033[0m"; break;
|
||||||
|
case Severity::critical: return "\033[01;31mCRITICAL\033[0m"; break;
|
||||||
case Severity::error: return "\033[01;31mERROR\033[0m"; break;
|
case Severity::error: return "\033[01;31mERROR\033[0m"; break;
|
||||||
case Severity::alarm: return "\033[01;33mALARM\033[0m"; break;
|
case Severity::alarm: return "\033[01;33mALARM\033[0m"; break;
|
||||||
case Severity::important: return "\033[01;32mIMPORTANT\033[0m"; break;
|
case Severity::important: return "\033[01;32mIMPORTANT\033[0m"; break;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
* Copyright (C) 2014-2025 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
||||||
* *
|
* *
|
||||||
* This software is distributed under the terms of the *
|
* This software is distributed under the terms of the *
|
||||||
* GNU Lesser General Public Licence (LGPL) version 3, *
|
* GNU Lesser General Public Licence (LGPL) version 3, *
|
||||||
|
@ -67,7 +67,8 @@ enum class Severity : int
|
||||||
important = 11,
|
important = 11,
|
||||||
alarm = 12,
|
alarm = 12,
|
||||||
error = 13,
|
error = 13,
|
||||||
fatal = 14,
|
critical = 14,
|
||||||
|
fatal = 15,
|
||||||
// aliases
|
// aliases
|
||||||
warning = warn,
|
warning = warn,
|
||||||
// backwards-compatibility
|
// backwards-compatibility
|
||||||
|
@ -325,7 +326,7 @@ class Logger
|
||||||
|
|
||||||
static const std::unordered_map<std::string_view, Verbosity> fVerbosityMap;
|
static const std::unordered_map<std::string_view, Verbosity> fVerbosityMap;
|
||||||
static const std::unordered_map<std::string_view, Severity> fSeverityMap;
|
static const std::unordered_map<std::string_view, Severity> fSeverityMap;
|
||||||
static const std::array<std::string_view, 15> fSeverityNames;
|
static const std::array<std::string_view, 16> fSeverityNames;
|
||||||
static const std::array<std::string_view, 9> fVerbosityNames;
|
static const std::array<std::string_view, 9> fVerbosityNames;
|
||||||
|
|
||||||
// protection for use after static destruction took place
|
// protection for use after static destruction took place
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (C) 2015-2020 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
* Copyright (C) 2015-2025 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
||||||
* *
|
* *
|
||||||
* This software is distributed under the terms of the *
|
* This software is distributed under the terms of the *
|
||||||
* GNU Lesser General Public Licence (LGPL) version 3, *
|
* GNU Lesser General Public Licence (LGPL) version 3, *
|
||||||
|
@ -38,7 +38,7 @@ int main()
|
||||||
Logger::SetConsoleSeverity(Severity::fatal);
|
Logger::SetConsoleSeverity(Severity::fatal);
|
||||||
cout << "initial severity >" << Logger::GetConsoleSeverity() << "<" << endl << endl;
|
cout << "initial severity >" << Logger::GetConsoleSeverity() << "<" << endl << endl;
|
||||||
|
|
||||||
array<Severity, 15> severitiesUp{{ Severity::nolog, Severity::trace, Severity::debug4, Severity::debug3, Severity::debug2, Severity::debug1, Severity::debug, Severity::detail, Severity::info, Severity::state, Severity::warn, Severity::important, Severity::alarm, Severity::error, Severity::fatal }};
|
array<Severity, 16> severitiesUp{{ Severity::nolog, Severity::trace, Severity::debug4, Severity::debug3, Severity::debug2, Severity::debug1, Severity::debug, Severity::detail, Severity::info, Severity::state, Severity::warn, Severity::important, Severity::alarm, Severity::error, Severity::critical, Severity::fatal }};
|
||||||
#ifdef FAIR_MIN_SEVERITY
|
#ifdef FAIR_MIN_SEVERITY
|
||||||
for (unsigned int i = static_cast<int>(Severity::FAIR_MIN_SEVERITY); i < severitiesUp.size(); ++i) {
|
for (unsigned int i = static_cast<int>(Severity::FAIR_MIN_SEVERITY); i < severitiesUp.size(); ++i) {
|
||||||
#else
|
#else
|
||||||
|
@ -57,7 +57,7 @@ int main()
|
||||||
Logger::SetConsoleSeverity(Severity::fatal);
|
Logger::SetConsoleSeverity(Severity::fatal);
|
||||||
cout << "initial severity >" << Logger::GetConsoleSeverity() << "<" << endl << endl;
|
cout << "initial severity >" << Logger::GetConsoleSeverity() << "<" << endl << endl;
|
||||||
|
|
||||||
array<Severity, 15> severitiesDown{{ Severity::error, Severity::alarm, Severity::important, Severity::warn, Severity::state, Severity::info, Severity::detail, Severity::debug, Severity::debug1, Severity::debug2, Severity::debug3, Severity::debug4, Severity::trace, Severity::nolog, Severity::fatal }};
|
array<Severity, 16> severitiesDown{{ Severity::critical, Severity::error, Severity::alarm, Severity::important, Severity::warn, Severity::state, Severity::info, Severity::detail, Severity::debug, Severity::debug1, Severity::debug2, Severity::debug3, Severity::debug4, Severity::trace, Severity::nolog, Severity::fatal }};
|
||||||
#ifdef FAIR_MIN_SEVERITY
|
#ifdef FAIR_MIN_SEVERITY
|
||||||
for (unsigned int i = 0; i < severitiesDown.size() - static_cast<int>(Severity::FAIR_MIN_SEVERITY) - 1; ++i) {
|
for (unsigned int i = 0; i < severitiesDown.size() - static_cast<int>(Severity::FAIR_MIN_SEVERITY) - 1; ++i) {
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -31,6 +31,7 @@ void printEverySeverity()
|
||||||
LOG(important) << "important message, counter: " << i++;
|
LOG(important) << "important message, counter: " << i++;
|
||||||
LOG(alarm) << "alarm message, counter: " << i++;
|
LOG(alarm) << "alarm message, counter: " << i++;
|
||||||
LOG(error) << "error message, counter: " << i++;
|
LOG(error) << "error message, counter: " << i++;
|
||||||
|
LOG(critical) << "critical message, counter: " << i++;
|
||||||
LOG(fatal) << "fatal message, counter: " << i++;
|
LOG(fatal) << "fatal message, counter: " << i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ void printEverySeverity()
|
||||||
LOG(important) << "important message ";
|
LOG(important) << "important message ";
|
||||||
LOG(alarm) << "alarm message ";
|
LOG(alarm) << "alarm message ";
|
||||||
LOG(error) << "error message ";
|
LOG(error) << "error message ";
|
||||||
|
LOG(critical) << "critical message ";
|
||||||
}
|
}
|
||||||
|
|
||||||
void silentlyPrintAllVerbositiesWithSeverity(Severity sev)
|
void silentlyPrintAllVerbositiesWithSeverity(Severity sev)
|
||||||
|
|
|
@ -34,6 +34,7 @@ uint32_t printEverySeverity(uint32_t i)
|
||||||
LOG(important) << "important message, counter: " << i++;
|
LOG(important) << "important message, counter: " << i++;
|
||||||
LOG(alarm) << "alarm message, counter: " << i++;
|
LOG(alarm) << "alarm message, counter: " << i++;
|
||||||
LOG(error) << "error message, counter: " << i++;
|
LOG(error) << "error message, counter: " << i++;
|
||||||
|
LOG(critical) << "critical message, counter: " << i++;
|
||||||
LOG(fatal) << "fatal message, counter: " << i++;
|
LOG(fatal) << "fatal message, counter: " << i++;
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user