Entry ctor: accept associations
Pass a list of associations to the Entry ctor. This enables to create
associations between the error object and other objects, if such
associations exist.
Change-Id: I88a517efc0ead0a62b2e6558822d94b8fc1c6070
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/elog_entry.hpp b/elog_entry.hpp
index 5968145..79ddf00 100644
--- a/elog_entry.hpp
+++ b/elog_entry.hpp
@@ -14,6 +14,9 @@
sdbusplus::xyz::openbmc_project::Logging::server::Entry,
sdbusplus::org::openbmc::server::Associations>;
+using AssociationList =
+ std::vector<std::tuple<std::string, std::string, std::string>>;
+
/** @class Entry
* @brief OpenBMC logging entry implementation.
* @details A concrete implementation for the
@@ -47,7 +50,8 @@
uint64_t timestampErr,
Level severityErr,
std::string&& msgErr,
- std::vector<std::string>&& additionalDataErr) :
+ std::vector<std::string>&& additionalDataErr,
+ AssociationList&& objects) :
EntryIfaces(bus, path.c_str(), true)
{
id(idErr);
@@ -55,6 +59,7 @@
timestamp(timestampErr);
message(std::move(msgErr));
additionalData(std::move(additionalDataErr));
+ associations(std::move(objects));
// Emit deferred signal.
this->emit_object_added();
diff --git a/log_manager.cpp b/log_manager.cpp
index 3401e82..b094c0e 100644
--- a/log_manager.cpp
+++ b/log_manager.cpp
@@ -127,6 +127,7 @@
std::chrono::system_clock::now().time_since_epoch()).count();
auto objPath = std::string(OBJ_ENTRY) + '/' +
std::to_string(entryId);
+ AssociationList objects {};
entries.insert(std::make_pair(entryId, std::make_unique<Entry>(
busLog,
objPath,
@@ -134,7 +135,8 @@
ms, // Milliseconds since 1970
(Entry::Level)g_errLevelMap[errMsg],
std::move(errMsg),
- std::move(additionalData))));
+ std::move(additionalData),
+ std::move(objects))));
return;
}