manager: use new Logging.Cleared event
Modify the internal manager support for creating internal events
to be able to support the sdbusplus generated events. Transition
from the local Logging.Error.LogsCleared to the global Logging.Cleared
event. Clean up references to the old event.
Tested:
```
$ busctl --user call xyz.openbmc_project.Logging /xyz/openbmc_project/logging xyz.openbmc_project.Collection.DeleteAll DeleteAll
$ busctl --user introspect xyz.openbmc_project.Logging /xyz/openbmc_project/logging/entry/1 -l | cat
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
xyz.openbmc_project.Logging.Entry interface - - -
.GetEntry method - h -
.AdditionalData property as 5 "NUMBER_OF_LOGS=210" "_CODE_FILE=../log_manager.hpp" "_CODE_FUNC=virtual void phosphor::logging::Manager::deleteAll()" "_CODE_LINE=361" "_PID=3318436" emits-change writable
.EventId property s "" emits-change writable
.Id property u 1 emits-change writable
.Message property s "xyz.openbmc_project.Logging.Cleared" 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.Informational" emits-change writable
.Timestamp property t 1730408674348 emits-change writable
.UpdateTimestamp property t 1730408674348 emits-change writable
```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I470f33ae2f5bfae6bf6d6a80ac2c5f028e41da95
diff --git a/log_manager.hpp b/log_manager.hpp
index cd5ae1d..2535832 100644
--- a/log_manager.hpp
+++ b/log_manager.hpp
@@ -2,14 +2,14 @@
#include "elog_block.hpp"
#include "elog_entry.hpp"
-#include "xyz/openbmc_project/Collection/DeleteAll/server.hpp"
-#include "xyz/openbmc_project/Logging/Create/server.hpp"
-#include "xyz/openbmc_project/Logging/Entry/server.hpp"
#include "xyz/openbmc_project/Logging/Internal/Manager/server.hpp"
-#include "xyz/openbmc_project/Logging/error.hpp"
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
+#include <xyz/openbmc_project/Collection/DeleteAll/server.hpp>
+#include <xyz/openbmc_project/Logging/Create/server.hpp>
+#include <xyz/openbmc_project/Logging/Entry/server.hpp>
+#include <xyz/openbmc_project/Logging/event.hpp>
#include <list>
@@ -26,8 +26,7 @@
sdbusplus::server::xyz::openbmc_project::collection::DeleteAll;
using Severity = sdbusplus::xyz::openbmc_project::Logging::server::Entry::Level;
-using LogsCleared =
- sdbusplus::xyz::openbmc_project::Logging::Error::LogsCleared;
+using LoggingCleared = sdbusplus::event::xyz::openbmc_project::Logging::Cleared;
namespace details
{
@@ -187,6 +186,13 @@
const FFDCEntries& ffdc = FFDCEntries{})
-> sdbusplus::message::object_path;
+ /** @brief Create an internal event log from the sdbusplus generated event
+ *
+ * @param[in] event - The event to create.
+ */
+ auto createFromEvent(sdbusplus::exception::generated_event_base&& event)
+ -> sdbusplus::message::object_path;
+
/** @brief Common wrapper for creating an Entry object
*
* @return true if quiesce on error setting is enabled, false otherwise
@@ -351,10 +357,8 @@
{
log<level::INFO>("Deleting all log entries");
auto numbersOfLogs = manager.eraseAll();
- std::map<std::string, std::string> additionalData;
- additionalData.emplace("NUM_LOGS", std::to_string(numbersOfLogs));
- manager.create(LogsCleared::errName, Severity::Informational,
- additionalData);
+ manager.createFromEvent(
+ LoggingCleared("NUMBER_OF_LOGS", numbersOfLogs));
}
/** @brief D-Bus method call implementation to create an event log.