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/utilities/requester/set_state_effecter.cpp b/utilities/requester/set_state_effecter.cpp
index 7e98c0b..c71f079 100644
--- a/utilities/requester/set_state_effecter.cpp
+++ b/utilities/requester/set_state_effecter.cpp
@@ -2,10 +2,13 @@
 #include <libpldm/pldm.h>
 
 #include <CLI/CLI.hpp>
+#include <phosphor-logging/lg2.hpp>
 
 #include <array>
 #include <iostream>
 
+PHOSPHOR_LOG2_USING;
+
 int main(int argc, char** argv)
 {
     CLI::App app{"Send PLDM command SetStateEffecterStates"};
@@ -29,8 +32,8 @@
                                                    &stateField, request);
     if (rc != PLDM_SUCCESS)
     {
-        std::cerr << "Message encode failure. PLDM error code = " << std::hex
-                  << std::showbase << rc << "\n";
+        error("Message encode failure. PLDM error code = {RC}", "RC", lg2::hex,
+              rc);
         return -1;
     }
 
@@ -38,8 +41,7 @@
     int fd = pldm_open();
     if (-1 == fd)
     {
-        std::cerr << "Failed to init mctp"
-                  << "\n";
+        error("Failed to init mctp");
         return -1;
     }
 
@@ -50,13 +52,14 @@
                         &responseMsg, &responseMsgSize);
     if (0 > rc)
     {
-        std::cerr << "Failed to send message/receive response. RC = " << rc
-                  << ", errno = " << errno << "\n";
+        error(
+            "Failed to send message/receive response. RC = {RC}, errno = {ERR}",
+            "RC", rc, "ERR", errno);
         return -1;
     }
     pldm_msg* response = reinterpret_cast<pldm_msg*>(responseMsg);
-    std::cout << "Done. PLDM RC = " << std::hex << std::showbase
-              << static_cast<uint16_t>(response->payload[0]) << std::endl;
+    info("Done. PLDM RC = {RC}", "RC", lg2::hex,
+         static_cast<uint16_t>(response->payload[0]));
     free(responseMsg);
 
     return 0;