Logging.Create: return result path from create call
Support new object path return from Logging.Create.
See Ia010e53fda55cef8b9cfc948482e133f20040320.
```
$ busctl --user call xyz.openbmc_project.Logging /xyz/openbmc_project/logging xyz.openbmc_project.Logging.Create Create "ssa{ss}" "Example Event" xyz.openbmc_project.Logging.Entry.Level.Error 0
o "/xyz/openbmc_project/logging/entry/1"
$ busctl --user introspect xyz.openbmc_project.Logging /xyz/openbmc_project/logging/entry/1 -l
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
org.freedesktop.DBus.Introspectable interface - - -
.Introspect method - s -
org.freedesktop.DBus.Peer interface - - -
.GetMachineId method - s -
.Ping method - - -
org.freedesktop.DBus.Properties interface - - -
.Get method ss v -
.GetAll method s a{sv} -
.Set method ssv - -
.PropertiesChanged signal sa{sv}as - -
xyz.openbmc_project.Association.Definitions interface - - -
.Associations property a(sss) 0 emits-change writable
xyz.openbmc_project.Common.FilePath interface - - -
.Path property s "/tmp/phosphor-logging/errors/1" emits-change writable
xyz.openbmc_project.Logging.Entry interface - - -
.GetEntry method - h -
.AdditionalData property as 0 emits-change writable
.EventId property s "" emits-change writable
.Id property u 1 emits-change writable
.Message property s "Example Event" emits-change writable
.Resolution property s "" emits-change writable
.Resolved property b false emits-change writable
.ServiceProviderNotify property s "xyz.openbmc_project.Logging.Entry.Notify.NotSupported" emits-change writable
.Severity property s "xyz.openbmc_project.Logging.Entry.Level.Error" emits-change writable
.Timestamp property t 1727728256156 emits-change writable
.UpdateTimestamp property t 1727728256156 emits-change writable
xyz.openbmc_project.Object.Delete interface - - -
.Delete method - - -
xyz.openbmc_project.Software.Version interface - - -
.Purpose property s "xyz.openbmc_project.Software.Version.VersionPurpose.BMC" emits-change writable
.Version property s "2.15" emits-change writable
```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Id2f45a1376a88d9785e860a47ea1135179b28ed9
diff --git a/log_manager.cpp b/log_manager.cpp
index 0992160..1b0cf3f 100644
--- a/log_manager.cpp
+++ b/log_manager.cpp
@@ -195,9 +195,10 @@
createEntry(errMsg, errLvl, additionalData);
}
-void Manager::createEntry(std::string errMsg, Entry::Level errLvl,
- std::vector<std::string> additionalData,
- const FFDCEntries& ffdc)
+auto Manager::createEntry(
+ std::string errMsg, Entry::Level errLvl,
+ std::vector<std::string> additionalData,
+ const FFDCEntries& ffdc) -> sdbusplus::message::object_path
{
if (!Extensions::disableDefaultLogCaps())
{
@@ -254,6 +255,8 @@
doExtensionLogCreate(*entries.find(entryId)->second, ffdc);
// Note: No need to close the file descriptors in the FFDC.
+
+ return objPath;
}
bool Manager::isQuiesceOnErrorEnabled()
@@ -691,15 +694,15 @@
return version.value_or("");
}
-void Manager::create(const std::string& message, Entry::Level severity,
+auto Manager::create(const std::string& message, Entry::Level severity,
const std::map<std::string, std::string>& additionalData,
- const FFDCEntries& ffdc)
+ const FFDCEntries& ffdc) -> sdbusplus::message::object_path
{
// Convert the map into a vector of "key=value" strings
std::vector<std::string> ad;
metadata::associations::combine(additionalData, ad);
- createEntry(message, severity, ad, ffdc);
+ return createEntry(message, severity, ad, ffdc);
}
} // namespace internal
diff --git a/log_manager.hpp b/log_manager.hpp
index 436f572..cd5ae1d 100644
--- a/log_manager.hpp
+++ b/log_manager.hpp
@@ -182,9 +182,10 @@
* Failure Data Capture). These will be passed to any
* event logging extensions.
*/
- void create(const std::string& message, Severity severity,
+ auto create(const std::string& message, Severity severity,
const std::map<std::string, std::string>& additionalData,
- const FFDCEntries& ffdc = FFDCEntries{});
+ const FFDCEntries& ffdc = FFDCEntries{})
+ -> sdbusplus::message::object_path;
/** @brief Common wrapper for creating an Entry object
*
@@ -262,9 +263,10 @@
* @param[in] ffdc - A vector of FFDC file info. Defaults to an empty
* vector.
*/
- void createEntry(std::string errMsg, Entry::Level errLvl,
+ auto createEntry(std::string errMsg, Entry::Level errLvl,
std::vector<std::string> additionalData,
- const FFDCEntries& ffdc = FFDCEntries{});
+ const FFDCEntries& ffdc = FFDCEntries{})
+ -> sdbusplus::message::object_path;
/** @brief Notified on entry property changes
*
@@ -362,10 +364,11 @@
* @param[in] severity - Level of the error
* @param[in] additionalData - The AdditionalData property for the error
*/
- void create(std::string message, Severity severity,
- std::map<std::string, std::string> additionalData) override
+ auto create(std::string message, Severity severity,
+ std::map<std::string, std::string> additionalData)
+ -> sdbusplus::message::object_path override
{
- manager.create(message, severity, additionalData);
+ return manager.create(message, severity, additionalData);
}
/** @brief D-Bus method call implementation to create an event log with FFDC