Skip to content

Commit 597f24a

Browse files
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 <[email protected]> Change-Id: Id2f45a1376a88d9785e860a47ea1135179b28ed9
1 parent fa2d962 commit 597f24a

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

log_manager.cpp

+9-6
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,10 @@ void Manager::_commit(uint64_t transactionId [[maybe_unused]],
195195
createEntry(errMsg, errLvl, additionalData);
196196
}
197197

198-
void Manager::createEntry(std::string errMsg, Entry::Level errLvl,
199-
std::vector<std::string> additionalData,
200-
const FFDCEntries& ffdc)
198+
auto Manager::createEntry(
199+
std::string errMsg, Entry::Level errLvl,
200+
std::vector<std::string> additionalData,
201+
const FFDCEntries& ffdc) -> sdbusplus::message::object_path
201202
{
202203
if (!Extensions::disableDefaultLogCaps())
203204
{
@@ -254,6 +255,8 @@ void Manager::createEntry(std::string errMsg, Entry::Level errLvl,
254255
doExtensionLogCreate(*entries.find(entryId)->second, ffdc);
255256

256257
// Note: No need to close the file descriptors in the FFDC.
258+
259+
return objPath;
257260
}
258261

259262
bool Manager::isQuiesceOnErrorEnabled()
@@ -691,15 +694,15 @@ std::string Manager::readFWVersion()
691694
return version.value_or("");
692695
}
693696

694-
void Manager::create(const std::string& message, Entry::Level severity,
697+
auto Manager::create(const std::string& message, Entry::Level severity,
695698
const std::map<std::string, std::string>& additionalData,
696-
const FFDCEntries& ffdc)
699+
const FFDCEntries& ffdc) -> sdbusplus::message::object_path
697700
{
698701
// Convert the map into a vector of "key=value" strings
699702
std::vector<std::string> ad;
700703
metadata::associations::combine(additionalData, ad);
701704

702-
createEntry(message, severity, ad, ffdc);
705+
return createEntry(message, severity, ad, ffdc);
703706
}
704707

705708
} // namespace internal

log_manager.hpp

+10-7
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,10 @@ class Manager : public details::ServerObject<details::ManagerIface>
182182
* Failure Data Capture). These will be passed to any
183183
* event logging extensions.
184184
*/
185-
void create(const std::string& message, Severity severity,
185+
auto create(const std::string& message, Severity severity,
186186
const std::map<std::string, std::string>& additionalData,
187-
const FFDCEntries& ffdc = FFDCEntries{});
187+
const FFDCEntries& ffdc = FFDCEntries{})
188+
-> sdbusplus::message::object_path;
188189

189190
/** @brief Common wrapper for creating an Entry object
190191
*
@@ -262,9 +263,10 @@ class Manager : public details::ServerObject<details::ManagerIface>
262263
* @param[in] ffdc - A vector of FFDC file info. Defaults to an empty
263264
* vector.
264265
*/
265-
void createEntry(std::string errMsg, Entry::Level errLvl,
266+
auto createEntry(std::string errMsg, Entry::Level errLvl,
266267
std::vector<std::string> additionalData,
267-
const FFDCEntries& ffdc = FFDCEntries{});
268+
const FFDCEntries& ffdc = FFDCEntries{})
269+
-> sdbusplus::message::object_path;
268270

269271
/** @brief Notified on entry property changes
270272
*
@@ -362,10 +364,11 @@ class Manager : public details::ServerObject<DeleteAllIface, CreateIface>
362364
* @param[in] severity - Level of the error
363365
* @param[in] additionalData - The AdditionalData property for the error
364366
*/
365-
void create(std::string message, Severity severity,
366-
std::map<std::string, std::string> additionalData) override
367+
auto create(std::string message, Severity severity,
368+
std::map<std::string, std::string> additionalData)
369+
-> sdbusplus::message::object_path override
367370
{
368-
manager.create(message, severity, additionalData);
371+
return manager.create(message, severity, additionalData);
369372
}
370373

371374
/** @brief D-Bus method call implementation to create an event log with FFDC

0 commit comments

Comments
 (0)