Enable readability check
readability-avoid-nested-conditional-operator
With one exception, we already pass this check. Update the log services
code to make it pass, and update it to use the generated enums.
Tested: Code inspection only.
Change-Id: Ic80a7382beb0f541de4916d7b51e42ed5d5dc542
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 24f0251..4ea01e3 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -2594,9 +2594,17 @@
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;