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/fru_parser.cpp b/libpldmresponder/fru_parser.cpp
index c875ffa..364a26b 100644
--- a/libpldmresponder/fru_parser.cpp
+++ b/libpldmresponder/fru_parser.cpp
@@ -48,9 +48,8 @@
auto data = Json::parse(jsonFile, nullptr, false);
if (data.is_discarded())
{
- error(
- "Parsing FRU Dbus Lookup Map config file failed, FILE={JSON_PATH}",
- "JSON_PATH", masterJsonPath.c_str());
+ error("Failed to parse FRU Dbus Lookup Map config file '{PATH}'",
+ "PATH", masterJsonPath.c_str());
std::abort();
}
std::map<Interface, EntityType> defIntfToEntityType;
@@ -65,7 +64,8 @@
}
catch (const std::exception& e)
{
- error("FRU DBus lookup map format error: {ERROR}", "ERROR", e);
+ error("Failure in FRU dbus lookup map format, error - {ERROR}",
+ "ERROR", e);
throw InternalFailure();
}
}
@@ -117,8 +117,8 @@
auto data = Json::parse(jsonFile, nullptr, false);
if (data.is_discarded())
{
- error("Parsing FRU config file failed, FILE={FILE_PATH}",
- "FILE_PATH", file.path().c_str());
+ error("Failed to parse FRU config file at '{PATH}'", "PATH",
+ file.path().c_str());
throw InternalFailure();
}