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/pdr_utils.cpp b/libpldmresponder/pdr_utils.cpp
index e7f6d42..cfc776f 100644
--- a/libpldmresponder/pdr_utils.cpp
+++ b/libpldmresponder/pdr_utils.cpp
@@ -98,8 +98,9 @@
if (dBusValues.size() != pv.size())
{
error(
- "dBusValues size is not equal to pv size, dBusValues Size: {DBUS_VAL_SIZE}, pv Size: {PV_SIZE}",
- "DBUS_VAL_SIZE", dBusValues.size(), "PV_SIZE", pv.size());
+ "DBusValues size '{DBUS_VALUE_SIZE}' is not equal to pv size'{PROPERTY_VALUE_SIZE}'.",
+ "DBUS_VALUE_SIZE", dBusValues.size(), "PROPERTY_VALUE_SIZE",
+ pv.size());
return {};
}
@@ -147,8 +148,7 @@
}
else
{
- error("Unknown D-Bus property type, TYPE={OTHER_TYPE}",
- "OTHER_TYPE", type.c_str());
+ error("Unknown D-Bus property type '{TYPE}'", "TYPE", type);
return {};
}
@@ -218,7 +218,8 @@
// uint8_t(FRU Field Type), uint8_t(FRU Field Length)
if (fruLen < fruRecordDataFormatLength)
{
- lg2::error("Invalid fru len: {FRULEN}", "FRULEN", fruLen);
+ error("Invalid FRU length '{LENGTH}' while parsing FRU record table",
+ "LENGTH", fruLen);
return {};
}