Move the control application to lg2

Update the logging API used for files in phosphor-fan-presence/control
from the older phosphor::logging::log to the more recent lg2::log.

Tested:
* Verified journal traces worked correctly in simulation.
* Modified json to force various property errors and verified
  correct key/value pairs in the journalctl output.

Change-Id: If1ac33b90abe2a9baae6f3cc788863bd514fa80e
Signed-off-by: Anwaar Hadi <anwaar.hadi@ibm.com>
diff --git a/control/json/triggers/init.cpp b/control/json/triggers/init.cpp
index 3d9a535..4d24c93 100644
--- a/control/json/triggers/init.cpp
+++ b/control/json/triggers/init.cpp
@@ -22,10 +22,9 @@
 #include "trigger_aliases.hpp"
 
 #include <nlohmann/json.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
 
 #include <algorithm>
-#include <format>
 #include <iterator>
 #include <memory>
 #include <numeric>
@@ -36,7 +35,6 @@
 {
 
 using json = nlohmann::json;
-using namespace phosphor::logging;
 
 void getProperties(Manager* mgr, const Group& group)
 {
@@ -107,11 +105,9 @@
                 // Path and/or interface configured does not exist on dbus?
                 // TODO How to handle this? Create timer to keep checking for
                 // object/service to appear? When to stop checking?
-                log<level::ERR>(
-                    std::format(
-                        "Unable to get service name for path {}, interface {}",
-                        member, intf)
-                        .c_str());
+                lg2::error(
+                    "Unable to get service name for path {MEMBER}, interface {GROUP_INTERFACE}",
+                    "MEMBER", member, "GROUP_INTERFACE", intf);
             }
         }
         catch (const util::DBusMethodError& dme)
@@ -127,10 +123,11 @@
                 // Path and/or interface configured does not exist on dbus?
                 // TODO How to handle this? Create timer to keep checking for
                 // object/service to appear? When to stop checking?
-                log<level::ERR>(std::format("Unable to get service({}) owner "
-                                            "state for path {}, interface {}",
-                                            servName, member, intf)
-                                    .c_str());
+                lg2::error(
+                    "Unable to get service({SERVICE}) owner "
+                    "state for path {MEMBER}, interface {GROUP_INTERFACE}",
+                    "SERVICE", servName, "MEMBER", member, "GROUP_INTERFACE",
+                    intf);
                 throw dme;
             }
         }
@@ -164,12 +161,12 @@
                 methods.begin()->first, [](auto list, auto method) {
                     return std::move(list) + ", " + method.first;
                 });
-            auto msg =
-                std::format("Event '{}' requires a supported method given to "
-                            "be init driven, available methods: {}",
-                            eventName, availMethods);
-            log<level::ERR>(msg.c_str());
-            throw std::runtime_error(msg.c_str());
+            lg2::error(
+                "Event '{EVENT_NAME}' requires a supported method given to "
+                "be init driven, available methods: {AVAILABLE_METHODS}",
+                "EVENT_NAME", eventName, "AVAILABLE_METHODS", availMethods);
+            throw std::runtime_error(
+                "Event requires a supported method given to be init driven");
         }
 
         for (const auto& group : groups)