diff options
author | Jason M. Bills <jason.m.bills@intel.com> | 2022-06-24 20:10:15 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2022-06-28 03:07:06 +0300 |
commit | 3a48b3a27ffbe86d931fb4eb771baa136d5baf2b (patch) | |
tree | eaaf1d81dd053047e6bbc96821fe7be9b619fb1d /redfish-core/lib/log_services.hpp | |
parent | de703c5d109061198dee7a9ea6ce64d5a8121dbb (diff) | |
download | bmcweb-3a48b3a27ffbe86d931fb4eb771baa136d5baf2b.tar.xz |
log_services: use nlohmann::json::object_t
This updates fillBMCJournalLogEntryJson() and the crashdump logEntry to
use the nlohmann::json::object_t type.
Tested:
Confirmed that the journal and crashdump entries are still displayed
correctly.
Change-Id: Ia940a41aab8e17bac006ee7735b33132e211d5a0
Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
Diffstat (limited to 'redfish-core/lib/log_services.hpp')
-rw-r--r-- | redfish-core/lib/log_services.hpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp index 050e7a78cd..0a1686674e 100644 --- a/redfish-core/lib/log_services.hpp +++ b/redfish-core/lib/log_services.hpp @@ -2103,9 +2103,10 @@ inline void requestRoutesBMCJournalLogService(App& app) }); } -static int fillBMCJournalLogEntryJson(const std::string& bmcJournalLogEntryID, - sd_journal* journal, - nlohmann::json& bmcJournalLogEntryJson) +static int + fillBMCJournalLogEntryJson(const std::string& bmcJournalLogEntryID, + sd_journal* journal, + nlohmann::json::object_t& bmcJournalLogEntryJson) { // Get the Log Entry contents int ret = 0; @@ -2227,14 +2228,14 @@ inline void requestRoutesBMCJournalLogEntryCollection(App& app) } firstEntry = false; - logEntryArray.push_back({}); - nlohmann::json& bmcJournalLogEntry = logEntryArray.back(); + nlohmann::json::object_t bmcJournalLogEntry; if (fillBMCJournalLogEntryJson(idStr, journal.get(), bmcJournalLogEntry) != 0) { messages::internalError(asyncResp->res); return; } + logEntryArray.push_back(std::move(bmcJournalLogEntry)); } asyncResp->res.jsonValue["Members@odata.count"] = entryCount; if (delegatedQuery.skip + delegatedQuery.top < entryCount) @@ -2307,12 +2308,14 @@ inline void requestRoutesBMCJournalLogEntry(App& app) return; } + nlohmann::json::object_t bmcJournalLogEntry; if (fillBMCJournalLogEntryJson(entryID, journal.get(), - asyncResp->res.jsonValue) != 0) + bmcJournalLogEntry) != 0) { messages::internalError(asyncResp->res); return; } + asyncResp->res.jsonValue = std::move(bmcJournalLogEntry); }); } @@ -2774,7 +2777,7 @@ static void std::string crashdumpURI = "/redfish/v1/Systems/system/LogServices/Crashdump/Entries/" + logID + "/" + filename; - nlohmann::json logEntry = { + nlohmann::json::object_t logEntry = { {"@odata.type", "#LogEntry.v1_7_0.LogEntry"}, {"@odata.id", "/redfish/v1/Systems/system/LogServices/Crashdump/Entries/" + |