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/profile.cpp b/control/json/profile.cpp
index 0778820..c56307f 100644
--- a/control/json/profile.cpp
+++ b/control/json/profile.cpp
@@ -18,7 +18,7 @@
 #include "sdbusplus.hpp"
 
 #include <nlohmann/json.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
 
 #include <algorithm>
 #include <iterator>
@@ -28,7 +28,6 @@
 {
 
 using json = nlohmann::json;
-using namespace phosphor::logging;
 
 // String key must be in all lowercase for method lookup
 const std::map<std::string, methodHandler> Profile::_methods = {
@@ -44,8 +43,7 @@
     if (!jsonObj.contains("method") || !jsonObj["method"].contains("name"))
     {
         // Log error on missing profile method
-        log<level::ERR>("Missing required profile method",
-                        entry("JSON=%s", jsonObj.dump().c_str()));
+        lg2::error("Missing required profile method", "JSON", jsonObj.dump());
         throw std::runtime_error("Missing required profile method");
     }
     // The method to use in determining if the profile is active
@@ -65,9 +63,9 @@
             _methods.begin()->first, [](auto list, auto method) {
                 return std::move(list) + ", " + method.first;
             });
-        log<level::ERR>("Configured method not available",
-                        entry("JSON=%s", jsonObj["method"].dump().c_str()),
-                        entry("METHODS_AVAILABLE=%s", methods.c_str()));
+        lg2::error(
+            "Configured method not available. Available methods are {METHODS_AVAILABLE}",
+            "METHODS_AVAILABLE", methods, "JSON", jsonObj["method"].dump());
     }
 }
 
@@ -75,8 +73,8 @@
 {
     if (!method.contains("properties"))
     {
-        log<level::ERR>("Missing required all_of method properties list",
-                        entry("JSON=%s", method.dump().c_str()));
+        lg2::error("Missing required all_of method properties list", "JSON",
+                   method.dump());
         throw std::runtime_error(
             "Missing required all_of method properties list");
     }
@@ -87,9 +85,8 @@
             if (!obj.contains("path") || !obj.contains("interface") ||
                 !obj.contains("property") || !obj.contains("value"))
             {
-                log<level::ERR>(
-                    "Missing required all_of method property parameters",
-                    entry("JSON=%s", obj.dump().c_str()));
+                lg2::error("Missing required all_of method property parameters",
+                           "JSON", obj.dump());
                 throw std::runtime_error(
                     "Missing required all_of method parameters");
             }