PLDM: Implementing Phosphor-Logging/LG2 logging
This commit adds changes in PLDM for implementing
structured LG2 logging, thereby moving away from
std::cout/cerr practice of logging which are
output streams and not logging mechanism.
PLDM now can make use of lg2 features like accurate
CODE LINE Number and CODE_FUNCTION Name and better
detailing in json object values which can be used in
log tracking.
More detailed logging change:
https://gist.github.com/riyadixitagra/c251685c1ba84248181891f7bc282395
Tested:
Ran a power off, on, cycle, and reset-reload.
Change-Id: I0485035f15f278c3fd172f0581b053c1c37f3a5b
Signed-off-by: Riya Dixit <riyadixitagra@gmail.com>
diff --git a/host-bmc/dbus_to_host_effecters.hpp b/host-bmc/dbus_to_host_effecters.hpp
index f8e165e..11721bb 100644
--- a/host-bmc/dbus_to_host_effecters.hpp
+++ b/host-bmc/dbus_to_host_effecters.hpp
@@ -5,10 +5,14 @@
#include "pldmd/dbus_impl_requester.hpp"
#include "requester/handler.hpp"
+#include <phosphor-logging/lg2.hpp>
+
#include <string>
#include <utility>
#include <vector>
+PHOSPHOR_LOG2_USING;
+
namespace pldm
{
@@ -91,8 +95,9 @@
}
catch (const std::exception& e)
{
- std::cerr << "The json file does not exist or malformed, ERROR="
- << e.what() << "\n";
+ error(
+ "The json file does not exist or malformed, ERROR={ERR_EXCEP}",
+ "ERR_EXCEP", e.what());
}
}