Create objects for existing logs on startup
Use getManagedObjects to find the existing error log
entries, and grab their Logging.Entry property map
to pass to the create function.
Change-Id: I798f13422483fdeea16a5acf54d31919f1c7c096
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/manager.cpp b/manager.cpp
index 73d77ed..773ef08 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -36,7 +36,38 @@
std::bind(std::mem_fn(&Manager::interfaceRemoved),
this, std::placeholders::_1))
{
- //TODO: createAll();
+ createAll();
+}
+
+void Manager::createAll()
+{
+ auto objects = getManagedObjects(
+ bus, LOGGING_BUSNAME, LOGGING_PATH);
+
+ for (const auto& object : objects)
+ {
+ const auto& interfaces = object.second;
+
+ auto propertyMap = std::find_if(
+ interfaces.begin(),
+ interfaces.end(),
+ [](const auto& i)
+ {
+ return i.first == LOGGING_IFACE;
+ });
+
+ if (propertyMap != interfaces.end())
+ {
+ create(object.first, propertyMap->second);
+ }
+ }
+}
+
+void Manager::create(
+ const std::string& objectPath,
+ const DbusPropertyMap& properties)
+{
+ //TODO
}
void Manager::interfaceAdded(sdbusplus::message::message& msg)
@@ -58,7 +89,7 @@
if (propertyMap != interfaces.end())
{
- //TODO: create(path, propertyMap->second);
+ create(path, propertyMap->second);
}
}