mirror of
https://github.com/FairRootGroup/FairLogger.git
synced 2025-10-15 17:41:44 +00:00
Add getters for file & custom sink severity
This commit is contained in:
@@ -350,14 +350,19 @@ void Logger::SetFileSeverity(const string& severityStr)
|
||||
|
||||
void Logger::SetCustomSeverity(const string& key, const Severity severity)
|
||||
{
|
||||
try {
|
||||
#ifdef FAIR_MIN_SEVERITY
|
||||
if (severity < Severity::FAIR_MIN_SEVERITY && severity != Severity::nolog) {
|
||||
cout << "Requested severity is higher than the enabled compile-time FAIR_MIN_SEVERITY (" << fSeverityNames.at(static_cast<int>(Severity::FAIR_MIN_SEVERITY)) << "), ignoring" << endl;
|
||||
return;
|
||||
}
|
||||
if (severity < Severity::FAIR_MIN_SEVERITY && severity != Severity::nolog) {
|
||||
cout << "Requested severity is higher than the enabled compile-time FAIR_MIN_SEVERITY (" << fSeverityNames.at(static_cast<int>(Severity::FAIR_MIN_SEVERITY)) << "), ignoring" << endl;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
fCustomSinks.at(key).first = severity; // TODO: range checks
|
||||
UpdateMinSeverity();
|
||||
fCustomSinks.at(key).first = severity; // TODO: range checks
|
||||
UpdateMinSeverity();
|
||||
} catch (const out_of_range& oor) {
|
||||
LOG(error) << "No custom sink with id '" << key << "' found";
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void Logger::SetCustomSeverity(const string& key, const string& severityStr)
|
||||
@@ -370,6 +375,16 @@ void Logger::SetCustomSeverity(const string& key, const string& severityStr)
|
||||
}
|
||||
}
|
||||
|
||||
Severity Logger::GetCustomSeverity(const std::string& key)
|
||||
{
|
||||
try {
|
||||
return fCustomSinks.at(key).first;
|
||||
} catch (const out_of_range& oor) {
|
||||
LOG(error) << "No custom sink with id '" << key << "' found";
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void Logger::CycleConsoleSeverityUp()
|
||||
{
|
||||
int current = static_cast<int>(fConsoleSeverity);
|
||||
|
Reference in New Issue
Block a user