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/libpldmresponder/fru.cpp b/libpldmresponder/fru.cpp
index 419f780..9b0389b 100644
--- a/libpldmresponder/fru.cpp
+++ b/libpldmresponder/fru.cpp
@@ -7,11 +7,14 @@
 #include <libpldm/utils.h>
 #include <systemd/sd-journal.h>
 
+#include <phosphor-logging/lg2.hpp>
 #include <sdbusplus/bus.hpp>
 
 #include <iostream>
 #include <set>
 
+PHOSPHOR_LOG2_USING;
+
 namespace pldm
 {
 namespace responder
@@ -39,8 +42,8 @@
     }
     catch (const std::exception& e)
     {
-        std::cerr << "Look up of inventory objects failed and PLDM FRU table "
-                     "creation failed\n";
+        error(
+            "Look up of inventory objects failed and PLDM FRU table creation failed");
         return;
     }
 
@@ -103,9 +106,9 @@
                 }
                 catch (const std::exception& e)
                 {
-                    std::cout << "Config JSONs missing for the item "
-                                 "interface type, interface = "
-                              << interface.first << "\n";
+                    info(
+                        "Config JSONs missing for the item interface type, interface = {INTF}",
+                        "INTF", interface.first);
                     break;
                 }
             }
@@ -150,9 +153,8 @@
     }
     catch (const std::exception& e)
     {
-        std::cerr << "failed to make a d-bus call "
-                     "Asociation, ERROR= "
-                  << e.what() << "\n";
+        error("failed to make a d-bus call Asociation, ERROR= {ERR_EXCEP}",
+              "ERR_EXCEP", e.what());
         return {};
     }
     return currentBmcVersion;