oem-ibm: 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: I24ca21de35d5a1a9b3cc64b28a149e4c213055f9
Signed-off-by: Riya Dixit <riyadixitagra@gmail.com>
diff --git a/oem/ibm/requester/dbus_to_file_handler.cpp b/oem/ibm/requester/dbus_to_file_handler.cpp
index 7f15103..19b3e6b 100644
--- a/oem/ibm/requester/dbus_to_file_handler.cpp
+++ b/oem/ibm/requester/dbus_to_file_handler.cpp
@@ -54,7 +54,8 @@
if (rc != PLDM_SUCCESS)
{
instanceIdDb->free(mctp_eid, instanceId);
- error("Failed to encode_new_file_req, rc = {RC}", "RC", rc);
+ error("Failed to encode new file request with response code '{RC}'",
+ "RC", rc);
return;
}
@@ -71,7 +72,7 @@
if (rc || completionCode)
{
error(
- "Failed to decode_new_file_resp or Host returned error for new_file_available rc={RC}, cc = {CC}",
+ "Failed to decode new file available response or remote terminus returned error, response code '{RC}' and completion code '{CC}'",
"RC", rc, "CC", static_cast<unsigned>(completionCode));
reportResourceDumpFailure();
}
@@ -81,7 +82,9 @@
std::move(requestMsg), std::move(newFileAvailableRespHandler));
if (rc)
{
- error("Failed to send NewFileAvailable Request to Host");
+ error(
+ "Failed to send NewFileAvailable Request to Host, response code '{RC}'",
+ "RC", rc);
reportResourceDumpFailure();
}
}
@@ -99,8 +102,8 @@
}
catch (const std::exception& e)
{
- error("failed to set resource dump operation status, ERROR={ERR_EXCEP}",
- "ERR_EXCEP", e.what());
+ error("Failed to set resource dump operation status, error - {ERROR}",
+ "ERROR", e);
}
}
@@ -123,9 +126,8 @@
catch (const sdbusplus::exception_t& e)
{
error(
- "Error {ERR_EXCEP} found in getting current resource dump status while initiating a new resource dump with objPath={DUMP_OBJ_PATH} and intf={DUMP_PROG_INTF}",
- "ERR_EXCEP", e.what(), "DUMP_OBJ_PATH",
- resDumpCurrentObjPath.str.c_str(), "DUMP_PROG_INTF",
+ "Error '{ERROR}' found in getting current resource dump status while initiating a new resource dump with object path '{PATH}' and interface {INTERFACE}",
+ "ERROR", e, "PATH", resDumpCurrentObjPath, "INTERFACE",
resDumpProgressIntf);
}
@@ -146,7 +148,7 @@
if (!fileHandle)
{
- error("resource dump file open error:{RES_DUMP_PATH}", "RES_DUMP_PATH",
+ error("Failed to open resource dump file '{PATH}'", "PATH",
resDumpFilePath);
PropertyValue value{resDumpStatus};
DBusMapping dbusMapping{resDumpCurrentObjPath, resDumpProgressIntf,
@@ -158,8 +160,8 @@
catch (const std::exception& e)
{
error(
- "failed to set resource dump operation status, ERROR={ERR_EXCEP}",
- "ERR_EXCEP", e.what());
+ "Failed to set resource dump operation status, error - {ERROR}",
+ "ERROR", e);
}
return;
}
@@ -224,8 +226,7 @@
if (!certFile)
{
- error("cert file open error: {CERT_PATH}", "CERT_PATH",
- certFilePath.c_str());
+ error("Failed to open certificate file '{PATH}'", "PATH", certFilePath);
return;
}
@@ -245,7 +246,7 @@
{
if (instanceIdDb == NULL)
{
- error("Failed to send csr to host.");
+ error("Failed to send csr to remote terminus.");
pldm::utils::reportError(
"xyz.openbmc_project.bmc.pldm.InternalFailure");
return;
@@ -260,7 +261,8 @@
if (rc != PLDM_SUCCESS)
{
instanceIdDb->free(mctp_eid, instanceId);
- error("Failed to encode_new_file_req, rc = {RC}", "RC", rc);
+ error("Failed to encode new file request with response code '{RC}'",
+ "RC", rc);
return;
}
auto newFileAvailableRespHandler =
@@ -276,7 +278,7 @@
if (rc || completionCode)
{
error(
- "Failed to decode_new_file_resp for vmi, or Host returned error for new_file_available rc = {RC}, cc = {CC}",
+ "Failed to decode new file available response for vmi or remote terminus returned error, response code '{RC}' and completion code '{CC}'",
"RC", rc, "CC", static_cast<unsigned>(completionCode));
pldm::utils::reportError(
"xyz.openbmc_project.bmc.pldm.InternalFailure");
@@ -287,7 +289,9 @@
std::move(requestMsg), std::move(newFileAvailableRespHandler));
if (rc)
{
- error("Failed to send NewFileAvailable Request to Host for vmi");
+ error(
+ "Failed to send NewFileAvailable Request to Host for vmi, response code '{RC}'",
+ "RC", rc);
pldm::utils::reportError(
"xyz.openbmc_project.bmc.pldm.InternalFailure");
}