Skip to content

Commit

Permalink
[OMON-599] Use InfoLogger devel level (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
awegrzyn authored Oct 5, 2022
1 parent 9f4b289 commit 84f7c63
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ endif()

# Define project
project(Monitoring
VERSION 3.13.2
VERSION 3.14.0
DESCRIPTION "O2 Monitoring library"
LANGUAGES CXX
)
Expand Down
2 changes: 1 addition & 1 deletion src/DerivedMetrics.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ bool DerivedMetrics::process(Metric& metric, DerivedMetricMode mode)
int timestampCount = timestampDifference.count();
// disallow dividing by 0
if (timestampCount == 0) {
throw MonitoringException("DerivedMetrics", "Division by 0");
throw MonitoringException("DerivedMetrics", "Division by 0 when calculating rate for: " + metric.getFirstValue().first);
}

auto current = metric.getFirstValue().second;
Expand Down
9 changes: 5 additions & 4 deletions src/MonLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ class MonLogger
context.setField(InfoLoggerContext::FieldName::System, "Monitoring");
context.setField(InfoLoggerContext::FieldName::Facility, "Library");
mStream.setContext(context);
static InfoLogger::AutoMuteToken wToken({InfoLogger::Severity::Warning, InfoLogger::Level::Support, -1, nullptr, -1}, 2, 60);
static InfoLogger::AutoMuteToken wToken({InfoLogger::Severity::Warning, InfoLogger::Level::Devel, -1, nullptr, -1}, 2, 60);

mMute = (static_cast<int>(severity) >= static_cast<int>(mLoggerSeverity) || severity == Severity::Error) ? false : true;
switch(severity) {
case Severity::Warn: mStream << &wToken; break;
default: mStream << static_cast<InfoLogger::Severity>(severity); break;
if (severity == Severity::Warn) {
mStream << &wToken;
} else {
mStream << InfoLogger::InfoLoggerMessageOption { static_cast<InfoLogger::Severity>(severity), InfoLogger::Level::Devel, -1, __FILE__, __LINE__ };
}
}
#else
Expand Down
2 changes: 1 addition & 1 deletion test/testDerived.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ bool exceptionCheck(const MonitoringException& e)
{
if (e.what() == std::string("Not enough values"))
return true;
if (e.what() == std::string("Division by 0"))
if (std::string(e.what()).find("Division by 0") != std::string::npos)
return true;
return false;
}
Expand Down

0 comments on commit 84f7c63

Please sign in to comment.