diff options
-rw-r--r-- | .clang-tidy | 1 | ||||
-rw-r--r-- | redfish-core/lib/log_services.hpp | 14 |
2 files changed, 12 insertions, 3 deletions
diff --git a/.clang-tidy b/.clang-tidy index 7cb9ecdd8e..ca103f34cf 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -305,6 +305,7 @@ performance-type-promotion-in-math-fn, performance-unnecessary-copy-initialization, performance-unnecessary-value-param, readability-avoid-const-params-in-decls, +readability-avoid-nested-conditional-operator, readability-braces-around-statements, readability-const-return-type, readability-container-contains, diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp index 24f0251ee1..4ea01e3531 100644 --- a/redfish-core/lib/log_services.hpp +++ b/redfish-core/lib/log_services.hpp @@ -2594,9 +2594,17 @@ static int bmcJournalLogEntryJson["Id"] = bmcJournalLogEntryID; bmcJournalLogEntryJson["Message"] = std::move(message); bmcJournalLogEntryJson["EntryType"] = "Oem"; - bmcJournalLogEntryJson["Severity"] = severity <= 2 ? "Critical" - : severity <= 4 ? "Warning" - : "OK"; + log_entry::EventSeverity severityEnum = log_entry::EventSeverity::OK; + if (severity <= 2) + { + severityEnum = log_entry::EventSeverity::Critical; + } + else if (severity <= 4) + { + severityEnum = log_entry::EventSeverity::Warning; + } + + bmcJournalLogEntryJson["Severity"] = severityEnum; bmcJournalLogEntryJson["OemRecordFormat"] = "BMC Journal Entry"; bmcJournalLogEntryJson["Created"] = std::move(entryTimeStr); return 0; |