libpldmresponder: Improving Logs (lg2)
This commit corrects the severity level of logs and also formats the
message string, fixing the ill-defined message string of the logs as
mentioned in the anti-pattern document [1]. Additionally, based on the
requirement this commit adds more debug information to logs.
[1]: https://github.com/openbmc/docs/blob/master/anti-patterns.md#ill-defined-data-structuring-in-lg2-message-strings
Change-Id: I7dc5c308a8cd76573995e07d01d1a6037bca31ba
Signed-off-by: Riya Dixit <riyadixitagra@gmail.com>
diff --git a/libpldmresponder/bios.cpp b/libpldmresponder/bios.cpp
index 48a3f28..d97229d 100644
--- a/libpldmresponder/bios.cpp
+++ b/libpldmresponder/bios.cpp
@@ -133,7 +133,7 @@
catch (const sdbusplus::exception_t& e)
{
error(
- "Error getting time from Elapsed property at '{PATH}' on '{INTERFACE}': {ERROR}",
+ "Error getting time from Elapsed property at path '{PATH}' on interface '{INTERFACE}': {ERROR}",
"PATH", bmcTimePath, "INTERFACE", timeInterface, "ERROR", e);
return CmdHandler::ccOnlyResponse(request, PLDM_ERROR);
}
@@ -187,9 +187,9 @@
catch (const std::exception& e)
{
error(
- "Error getting the time sync property, PATH={TIME_SYNC_PATH} INTERFACE={SYNC_INTERFACE} PROPERTY={SYNC_PROP} ERROR={ERR_EXCEP}",
+ "Failed to get the time sync property from path {TIME_SYNC_PATH}, interface '{SYNC_INTERFACE}' and property '{SYNC_PROPERTY}', error - '{ERROR}'",
"TIME_SYNC_PATH", timeSyncPath, "SYNC_INTERFACE", timeSyncInterface,
- "SYNC_PROP", timeSyncProperty, "ERR_EXCEP", e.what());
+ "SYNC_PROPERTY", timeSyncProperty, "ERROR", e);
}
constexpr auto setTimeInterface = "xyz.openbmc_project.Time.EpochTime";
@@ -217,9 +217,9 @@
catch (const std::exception& e)
{
error(
- "Error Setting time,PATH={SET_TIME_PATH} TIME INTERFACE={TIME_INTERFACE} ERROR={ERR_EXCEP}",
+ "Failed to set time at {SET_TIME_PATH}, interface '{TIME_INTERFACE}' and error - {ERROR}",
"SET_TIME_PATH", setTimePath, "TIME_INTERFACE", setTimeInterface,
- "ERR_EXCEP", e.what());
+ "ERROR", e);
return ccOnlyResponse(request, PLDM_ERROR);
}