logging: switch hyp-network-manager to lg2

Tested: Build passes with "ninja -C build".

Change-Id: If66b365354268d8577c48852876821f252ca88c8
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/src/ibm/hypervisor-network-mgr-src/hyp_network_manager.cpp b/src/ibm/hypervisor-network-mgr-src/hyp_network_manager.cpp
index ef401a1..c1e35d9 100644
--- a/src/ibm/hypervisor-network-mgr-src/hyp_network_manager.cpp
+++ b/src/ibm/hypervisor-network-mgr-src/hyp_network_manager.cpp
@@ -2,7 +2,7 @@
 
 #include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/elog.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/server/object.hpp>
 #include <xyz/openbmc_project/Common/error.hpp>
@@ -13,7 +13,6 @@
 {
 namespace network
 {
-using namespace phosphor::logging;
 using InternalFailure =
     sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
 
@@ -71,9 +70,9 @@
     }
     else
     {
-        log<level::INFO>(
-            "setBIOSTableAttr: Attribute is not found in biosTableAttrs"),
-            entry("attrName : ", attrName.c_str());
+        lg2::info("setBIOSTableAttr: Attribute {ATTR_NAME} is not found in "
+                  "biosTableAttrs",
+                  "ATTR_NAME", attrName);
     }
 }
 
@@ -113,7 +112,7 @@
         auto mapperReply = bus.call(mapperCall);
         if (mapperReply.is_method_error())
         {
-            log<level::ERR>("Error in mapper call");
+            lg2::error("Error in mapper call");
             elog<InternalFailure>();
         }
 
@@ -122,8 +121,9 @@
 
         if (objectTree.empty())
         {
-            log<level::ERR>("No Object has implemented the interface",
-                            entry("INTERFACE=%s", biosMgrIntf));
+            lg2::error(
+                "No Object has implemented the interface {INTERFACE_NAME}",
+                "INTERFACE_NAME", biosMgrIntf);
             elog<InternalFailure>();
         }
 
@@ -139,9 +139,8 @@
             // interface name
             for (auto const& object : objectTree)
             {
-                log<level::INFO>("interface", entry("INT=%s", biosMgrIntf));
-                log<level::INFO>("object",
-                                 entry("OBJ=%s", object.first.c_str()));
+                lg2::info("{INTERFACE_NAME}", "INTERFACE_NAME", biosMgrIntf);
+                lg2::info("{OBJECT}", "OBJECT", object.first);
 
                 if (std::string::npos != object.first.find(biosMgrIntf))
                 {
@@ -152,8 +151,9 @@
 
             if (objPath.empty())
             {
-                log<level::ERR>("Can't find the object for the interface",
-                                entry("intfName=%s", biosMgrIntf));
+                lg2::error(
+                    "Can't find the object for the interface {INTERFACE_NAME}",
+                    "INTERFACE_NAME", biosMgrIntf);
                 elog<InternalFailure>();
             }
         }
@@ -166,7 +166,7 @@
 
         if (baseBiosTable == nullptr)
         {
-            log<level::ERR>("BaseBiosTable is empty. No attributes found!");
+            lg2::error("BaseBiosTable is empty. No attributes found!");
             return;
         }
 
@@ -201,15 +201,15 @@
                 }
                 else
                 {
-                    log<level::ERR>("Unsupported datatype: The attribute is of "
-                                    "unknown type");
+                    lg2::error("Unsupported datatype: The attribute is of "
+                               "unknown type");
                 }
             }
         }
     }
     catch (const SdBusError& e)
     {
-        log<level::ERR>("Error in making dbus call");
+        lg2::error("Error in making dbus call");
         throw std::runtime_error("DBus call failed");
     }
 }
@@ -228,7 +228,7 @@
     // created during init time to support the static
     // network configurations on the both.
     // create eth0 and eth1 objects
-    log<level::INFO>("Creating eth0 and eth1 objects");
+    lg2::info("Creating eth0 and eth1 objects");
     interfaces.emplace("eth0",
                        std::make_unique<HypEthInterface>(
                            bus, (objectPath + "/eth0").c_str(), "eth0", *this));
diff --git a/src/ibm/hypervisor-network-mgr-src/hyp_sys_config.cpp b/src/ibm/hypervisor-network-mgr-src/hyp_sys_config.cpp
index 29c2660..853ee11 100644
--- a/src/ibm/hypervisor-network-mgr-src/hyp_sys_config.cpp
+++ b/src/ibm/hypervisor-network-mgr-src/hyp_sys_config.cpp
@@ -3,7 +3,7 @@
 #include "hyp_network_manager.hpp"
 
 #include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
 #include <xyz/openbmc_project/Common/error.hpp>
 
 namespace phosphor
@@ -15,7 +15,6 @@
 constexpr auto BIOS_OBJPATH = "/xyz/openbmc_project/bios_config/manager";
 constexpr auto BIOS_MGR_INTF = "xyz.openbmc_project.BIOSConfig.Manager";
 
-using namespace phosphor::logging;
 using namespace sdbusplus::xyz::openbmc_project::Common::Error;
 using InvalidArgumentMetadata = xyz::openbmc_project::Common::InvalidArgument;
 
@@ -64,8 +63,8 @@
     }
     catch (const sdbusplus::exception::SdBusError& ex)
     {
-        log<level::ERR>("Failed to get the hostname from bios table",
-                        entry("ERR=%s", ex.what()));
+        lg2::error("Failed to get the hostname from bios table: {ERROR}",
+                   "ERROR", ex);
     }
     return std::string();
 }