logging: switch to lg2

After switching to C++20, it is recommended to use `phosphor::lg2`
to format log, and the correct `CODE_LINE` and `CODE_FUNC` values
can be used in log tracking.

Tested: built ledManager successfully and Unit Test passes.

Before: The file does not exist or is empty
After: The file does not exist or is empty, FILE_PATH = /usr/share/phosphor-led-manager/lamp-test-led-overrides.json

MESSAGE=File does not exist, FILE_PATH = /var/lib/phosphor-led-manager/savedGroups
LOG2_FMTMSG=File does not exist, FILE_PATH = {PATH}
CODE_FILE=../../../../../../fp5280g2-workspace/sources/phosphor-led-manager/serialize.cpp
CODE_LINE=63
CODE_FUNC=void phosphor::led::Serialize::restoreGroups()
PATH=/var/lib/phosphor-led-manager/savedGroups
SYSLOG_IDENTIFIER=phosphor-ledmanager
_PID=298
_COMM=phosphor-ledman
_EXE=/usr/bin/phosphor-ledmanager
_CMDLINE=phosphor-ledmanager
_SYSTEMD_CGROUP=/system.slice/xyz.openbmc_project.LED.GroupManager.service
_SYSTEMD_UNIT=xyz.openbmc_project.LED.GroupManager.service
_SYSTEMD_INVOCATION_ID=5ddd4960a3b04fe29c34e4ce03b6be06

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I5ec8530e0b539bcf8d7d211c802430698aebd343
diff --git a/json-config.hpp b/json-config.hpp
index d625d49..9fb8ee1 100644
--- a/json-config.hpp
+++ b/json-config.hpp
@@ -1,6 +1,6 @@
 #include "utils.hpp"
 
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
 #include <sdbusplus/exception.hpp>
 #include <sdeventplus/event.hpp>
 
@@ -9,8 +9,6 @@
 
 namespace fs = std::filesystem;
 
-using namespace phosphor::logging;
-
 namespace phosphor
 {
 namespace led
@@ -186,11 +184,10 @@
                 catch (const sdbusplus::exception::exception& e)
                 {
                     // Property unavailable on object.
-                    log<level::ERR>(
-                        "Failed to get Names property",
-                        entry("ERROR=%s", e.what()),
-                        entry("INTERFACE=%s", confCompatibleInterface),
-                        entry("PATH=%s", path.c_str()));
+                    lg2::error(
+                        "Failed to get Names property, ERROR = {ERROR}, INTERFACES = {INTERFACES}, PATH = {PATH}",
+                        "ERROR", e, "INTERFACE", confCompatibleInterface,
+                        "PATH", path);
 
                     confFile.clear();
                 }
@@ -198,9 +195,9 @@
         }
         catch (const sdbusplus::exception::exception& e)
         {
-            log<level::ERR>("Failed to call the SubTreePaths method",
-                            entry("ERROR=%s", e.what()),
-                            entry("INTERFACE=%s", confCompatibleInterface));
+            lg2::error(
+                "Failed to call the SubTreePaths method, ERROR = {ERROR}, INTERFACE = {INTERFACE}",
+                "ERROR", e, "INTERFACE", confCompatibleInterface);
         }
         return;
     }