remove phosphor-logging dependency

This commit removes pldm's dependency on phosphor-logging
and instead uses stdout and stdcerr for logging purpose.This is to
break the build time circular dependency between pldm and
phosphor-logging.

Change-Id: I8cffa3c99eb34efad5f186b3452a86ebadec2074
Signed-off-by: Sampa Misra <sampmisr@in.ibm.com>
diff --git a/libpldmresponder/utils.cpp b/libpldmresponder/utils.cpp
index 766a183..8290675 100644
--- a/libpldmresponder/utils.cpp
+++ b/libpldmresponder/utils.cpp
@@ -6,14 +6,12 @@
 #include <ctime>
 #include <iostream>
 #include <map>
-#include <phosphor-logging/log.hpp>
 #include <stdexcept>
 #include <string>
 #include <vector>
 
 namespace pldm
 {
-using namespace phosphor::logging;
 
 constexpr auto mapperBusName = "xyz.openbmc_project.ObjectMapper";
 constexpr auto mapperPath = "/xyz/openbmc_project/object_mapper";
@@ -39,14 +37,42 @@
     }
     catch (std::exception& e)
     {
-        log<level::ERR>("Error in mapper call", entry("ERROR=%s", e.what()),
-                        entry("PATH=%s", path.c_str()),
-                        entry("INTERFACE=%s", interface.c_str()));
+        std::cerr << "Error in mapper call, ERROR=" << e.what()
+                  << " PATH=" << path.c_str()
+                  << " INTERFACE=" << interface.c_str() << "\n";
         throw;
     }
     return mapperResponse.begin()->first;
 }
 
+void reportError(const char* errorMsg)
+{
+    static constexpr auto logObjPath = "/xyz/openbmc_project/logging";
+    static constexpr auto logInterface = "xyz.openbmc_project.Logging.Create";
+
+    static sdbusplus::bus::bus bus = sdbusplus::bus::new_default();
+
+    try
+    {
+        auto service = getService(bus, logObjPath, logInterface);
+        using namespace sdbusplus::xyz::openbmc_project::Logging::server;
+        auto severity =
+            sdbusplus::xyz::openbmc_project::Logging::server::convertForMessage(
+                sdbusplus::xyz::openbmc_project::Logging::server::Entry::Level::
+                    Error);
+        auto method = bus.new_method_call(service.c_str(), logObjPath,
+                                          logInterface, "Create");
+        std::map<std::string, std::string> addlData{};
+        method.append(errorMsg, severity, addlData);
+        bus.call_noreply(method);
+    }
+    catch (const std::exception& e)
+    {
+        std::cerr << "failed to make a d-bus call to create error log, ERROR="
+                  << e.what() << "\n";
+    }
+}
+
 namespace utils
 {