use phosphor-logging
Migrate all instances of std::cerr and std::cout to phosphor-logging
such as lg2::error, lg2::info, lg2::debug, ...
The use of modern logging infrastructure helps with development since
additional logging levels such as `debug` and `warning` are available.
Migrating the remaining logging calls helps to make the code more
readable and uniform.
Tested: Inspection, and on Tyan S8030
Restarted EM with patch applied.
Logs appear as usual.
```
Sep 15 13:52:46 s8030-bmc-30303035c0c1 entity-manager[23480]: Inventory Added: Supermicro PWS 920P SQ 0
Sep 15 13:52:46 s8030-bmc-30303035c0c1 entity-manager[23480]: Inventory Added: Supermicro PWS 920P SQ 1
Sep 15 13:52:46 s8030-bmc-30303035c0c1 entity-manager[23480]: Inventory Added: Tyan S8030 Baseboard
Sep 15 13:52:46 s8030-bmc-30303035c0c1 entity-manager[23480]: Inventory Added: MBX 1.57 Chassis
```
`busctl tree` output appears as before.
Did a power cycle to trigger a few more log prints
```
Sep 15 13:55:14 s8030-bmc-30303035c0c1 entity-manager[23480]: power match triggered
```
Created configuration file with missing fields to trigger error print.
```
{
  "Exposes": [],
  "Type": "error"
}
```
```
Sep 15 13:56:58 s8030-bmc-30303035c0c1 entity-manager[23659]: Finished loading json configuration in 7938ms
Sep 15 13:56:58 s8030-bmc-30303035c0c1 entity-manager[23659]: configuration file missing probe:
                                                               {"Exposes":[],"Type":"error"}
Sep 15 13:56:59 s8030-bmc-30303035c0c1 entity-manager[23659]: configuration file missing probe:
                                                               {"Exposes":[],"Type":"error"}
```
Change-Id: I3452f983c9c14cd02ab9b56451c4b3e4a13c3979
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/src/entity_manager/dbus_interface.cpp b/src/entity_manager/dbus_interface.cpp
index 1492314..461b27c 100644
--- a/src/entity_manager/dbus_interface.cpp
+++ b/src/entity_manager/dbus_interface.cpp
@@ -5,6 +5,7 @@
 
 #include <boost/algorithm/string/case_conv.hpp>
 #include <boost/container/flat_map.hpp>
+#include <phosphor-logging/lg2.hpp>
 
 #include <fstream>
 #include <regex>
@@ -35,10 +36,10 @@
     }
     catch (std::exception& e)
     {
-        std::cerr << "Unable to initialize dbus interface : " << e.what()
-                  << "\n"
-                  << "object Path : " << iface->get_object_path() << "\n"
-                  << "interface name : " << iface->get_interface_name() << "\n";
+        lg2::error(
+            "Unable to initialize dbus interface : {ERR} object Path : {PATH} interface name : {INTF}",
+            "ERR", e, "PATH", iface->get_object_path(), "INTF",
+            iface->get_interface_name());
     }
 }
 
@@ -95,7 +96,7 @@
 
             if (!writeJsonFiles(systemConfiguration))
             {
-                std::cerr << "error setting json file\n";
+                lg2::error("error setting json file");
                 throw DBusInternalError();
             }
         });
@@ -190,8 +191,9 @@
         }
         default:
         {
-            std::cerr << "Unexpected json type in system configuration " << key
-                      << ": " << value.type_name() << "\n";
+            lg2::error(
+                "Unexpected json type in system configuration {KEY}: {VALUE}",
+                "KEY", key, "VALUE", value.type_name());
             break;
         }
     }
@@ -215,7 +217,7 @@
             type = value[0].type();
             if (!checkArrayElementsSameType(value))
             {
-                std::cerr << "dbus format error" << value << "\n";
+                lg2::error("dbus format error {VALUE}", "VALUE", value);
                 continue;
             }
         }
@@ -326,7 +328,7 @@
                     nlohmann::json::parse(schemaFile, nullptr, false, true);
                 if (schema.is_discarded())
                 {
-                    std::cerr << "Schema not legal" << *type << ".json\n";
+                    lg2::error("Schema not legal: {TYPE}.json", "TYPE", *type);
                     throw DBusInternalError();
                 }
 
@@ -346,7 +348,7 @@
             }
             if (!writeJsonFiles(systemConfiguration))
             {
-                std::cerr << "Error writing json files\n";
+                lg2::error("Error writing json files");
             }
             std::string dbusName = *name;