log_manager: remove redundant createWithFFDC
Fold the functionality of creating an event entry with FFDC appended
into a common implementation to avoid code duplication and to ease
further extension and maintainability.
Build-tested with 'openpower-pel-extension' enabled.
Change-Id: I0f8151b782bf42cc7bc0981e58f6ab1e3cda080c
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
diff --git a/extensions/openpower-pels/entry_points.cpp b/extensions/openpower-pels/entry_points.cpp
index d9e44c7..08cecb5 100644
--- a/extensions/openpower-pels/entry_points.cpp
+++ b/extensions/openpower-pels/entry_points.cpp
@@ -38,9 +38,10 @@
void pelStartup(internal::Manager& logManager)
{
- EventLogger::LogFunction logger = std::bind(
- std::mem_fn(&internal::Manager::create), &logManager,
- std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
+ EventLogger::LogFunction logger =
+ std::bind(std::mem_fn(&internal::Manager::create), &logManager,
+ std::placeholders::_1, std::placeholders::_2,
+ std::placeholders::_3, phosphor::logging::FFDCEntries{});
std::unique_ptr<DataInterfaceBase> dataIface =
std::make_unique<DataInterface>(logManager.getBus());
diff --git a/extensions/openpower-pels/manager.cpp b/extensions/openpower-pels/manager.cpp
index 9a64722..0689a8b 100644
--- a/extensions/openpower-pels/manager.cpp
+++ b/extensions/openpower-pels/manager.cpp
@@ -636,7 +636,7 @@
uint8_t, uint8_t, sdbusplus::message::unix_fd>>
fFDC)
{
- _logManager.createWithFFDC(message, severity, additionalData, fFDC);
+ _logManager.create(message, severity, additionalData, fFDC);
return {_logManager.lastEntryID(), _repo.lastPelID()};
}
diff --git a/log_manager.cpp b/log_manager.cpp
index cf7ef60..4cdbc4e 100644
--- a/log_manager.cpp
+++ b/log_manager.cpp
@@ -620,19 +620,8 @@
}
void Manager::create(const std::string& message, Entry::Level severity,
- const std::map<std::string, std::string>& additionalData)
-{
- // Convert the map into a vector of "key=value" strings
- std::vector<std::string> ad;
- metadata::associations::combine(additionalData, ad);
-
- createEntry(message, severity, ad);
-}
-
-void Manager::createWithFFDC(
- const std::string& message, Entry::Level severity,
- const std::map<std::string, std::string>& additionalData,
- const FFDCEntries& ffdc)
+ const std::map<std::string, std::string>& additionalData,
+ const FFDCEntries& ffdc)
{
// Convert the map into a vector of "key=value" strings
std::vector<std::string> ad;
diff --git a/log_manager.hpp b/log_manager.hpp
index 3fe8fee..e47d6b5 100644
--- a/log_manager.hpp
+++ b/log_manager.hpp
@@ -190,28 +190,14 @@
* error log to be committed.
* @param[in] severity - level of the error
* @param[in] additionalData - The AdditionalData property for the error
+ * @param[in] ffdc - A vector of tuples that allows one to pass in file
+ * descriptors for files that contain FFDC (First
+ * Failure Data Capture). These will be passed to any
+ * event logging extensions.
*/
void create(const std::string& message, Severity severity,
- const std::map<std::string, std::string>& additionalData);
-
- /** @brief Creates an event log, and accepts FFDC files
- *
- * This is the same as create(), but also takes an FFDC argument.
- *
- * The FFDC argument is a vector of tuples that allows one to pass in file
- * descriptors for files that contain FFDC (First Failure Data Capture).
- * These will be passed to any event logging extensions.
- *
- * @param[in] errMsg - The error exception message associated with the
- * error log to be committed.
- * @param[in] severity - level of the error
- * @param[in] additionalData - The AdditionalData property for the error
- * @param[in] ffdc - A vector of FFDC file info
- */
- void
- createWithFFDC(const std::string& message, Severity severity,
- const std::map<std::string, std::string>& additionalData,
- const FFDCEntries& ffdc);
+ const std::map<std::string, std::string>& additionalData,
+ const FFDCEntries& ffdc = FFDCEntries{});
/** @brief Common wrapper for creating an Entry object
*
@@ -412,7 +398,7 @@
sdbusplus::message::unix_fd>>
ffdc) override
{
- manager.createWithFFDC(message, severity, additionalData, ffdc);
+ manager.create(message, severity, additionalData, ffdc);
}
private: