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.

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: If1cbc1f1eb4ccd02fe2e95f2f09a4fd0b43a0851
diff --git a/association_manager.cpp b/association_manager.cpp
index c376718..ade689d 100644
--- a/association_manager.cpp
+++ b/association_manager.cpp
@@ -1,6 +1,6 @@
 #include "association_manager.hpp"
 
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
 
 #include <filesystem>
 #include <fstream>
@@ -13,7 +13,6 @@
 {
 namespace associations
 {
-using namespace phosphor::logging;
 namespace fs = std::filesystem;
 
 Manager::Manager(sdbusplus::bus::bus& bus, const std::string& jsonPath) :
@@ -66,10 +65,9 @@
                     !conditionJSON.contains("property") ||
                     !conditionJSON.contains("values"))
                 {
-                    std::string msg =
-                        "Invalid JSON in associations condition entry in " +
-                        path.string() + ". Skipping file.";
-                    log<level::ERR>(msg.c_str());
+                    lg2::error(
+                        "Invalid JSON in associations condition entry in {PATH}. Skipping file.",
+                        "PATH", path);
                     continue;
                 }
 
@@ -117,11 +115,11 @@
                     }
                     else
                     {
-                        std::stringstream ss;
-                        ss << "Invalid condition property value in " << c.file
-                           << ": " << value;
-                        log<level::ERR>(ss.str().c_str());
-                        throw std::runtime_error(ss.str());
+                        lg2::error(
+                            "Invalid condition property value in {FILE}:",
+                            "FILE", c.file);
+                        throw std::runtime_error(
+                            "Invalid condition property value");
                     }
                 }