PEL: Use lg2 in user_data_json.cpp

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I59944fbfd4ed8aba16c2c1a3742ff5e8d9d73066
diff --git a/extensions/openpower-pels/user_data_json.cpp b/extensions/openpower-pels/user_data_json.cpp
index 0e3ac24..34da02f 100644
--- a/extensions/openpower-pels/user_data_json.cpp
+++ b/extensions/openpower-pels/user_data_json.cpp
@@ -25,7 +25,7 @@
 #include <Python.h>
 
 #include <nlohmann/json.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
 
 #include <iomanip>
 #include <sstream>
@@ -33,7 +33,6 @@
 namespace openpower::pels::user_data
 {
 namespace pv = openpower::pels::pel_values;
-using namespace phosphor::logging;
 using orderedJSON = nlohmann::ordered_json;
 
 void pyDecRef(PyObject* pyObj)
@@ -302,13 +301,11 @@
         if (!PyDict_Contains(pDict, pKey))
         {
             Py_DECREF(pDict);
-            log<level::ERR>(
-                "Python module error",
-                entry("ERROR=%s",
-                      std::string(funcToCall + " function missing").c_str()),
-                entry("PARSER_MODULE=%s", module.c_str()),
-                entry("SUBTYPE=0x%X", subType), entry("VERSION=%d", version),
-                entry("DATA_LENGTH=%lu\n", data.size()));
+            lg2::error("Python module error.  Function missing: {FUNC}, "
+                       "module = {MODULE}, subtype = {SUBTYPE}, "
+                       "version = {VERSION}, data length = {LEN}",
+                       "FUNC", funcToCall, "MODULE", module, "SUBTYPE", subType,
+                       "VERSION", version, "LEN", data.size());
             return std::nullopt;
         }
         PyObject* pFunc = PyDict_GetItemString(pDict, funcToCall.c_str());
@@ -352,12 +349,11 @@
                 }
                 catch (const std::exception& e)
                 {
-                    log<level::ERR>("Bad JSON from parser",
-                                    entry("ERROR=%s", e.what()),
-                                    entry("PARSER_MODULE=%s", module.c_str()),
-                                    entry("SUBTYPE=0x%X", subType),
-                                    entry("VERSION=%d", version),
-                                    entry("DATA_LENGTH=%lu\n", data.size()));
+                    lg2::error("Bad JSON from parser.  Error = {ERROR}, "
+                               "module = {MODULE}, subtype = {SUBTYPE}, "
+                               "version = {VERSION}, data length = {LEN}",
+                               "ERROR", e, "MODULE", module, "SUBTYPE", subType,
+                               "VERSION", version, "LEN", data.size());
                     return std::nullopt;
                 }
             }
@@ -388,12 +384,11 @@
     }
     if (!pErrStr.empty())
     {
-        log<level::DEBUG>("Python exception thrown by parser",
-                          entry("ERROR=%s", pErrStr.c_str()),
-                          entry("PARSER_MODULE=%s", module.c_str()),
-                          entry("SUBTYPE=0x%X", subType),
-                          entry("VERSION=%d", version),
-                          entry("DATA_LENGTH=%lu\n", data.size()));
+        lg2::debug("Python exception thrown by parser.  Error = {ERROR}, "
+                   "module = {MODULE}, subtype = {SUBTYPE}, "
+                   "version = {VERSION}, data length = {LEN}",
+                   "ERROR", pErrStr, "MODULE", module, "SUBTYPE", subType,
+                   "VERSION", version, "LEN", data.size());
     }
     return std::nullopt;
 }
@@ -423,11 +418,11 @@
     }
     catch (const std::exception& e)
     {
-        log<level::ERR>("Failed parsing UserData", entry("ERROR=%s", e.what()),
-                        entry("COMP_ID=0x%X", componentID),
-                        entry("SUBTYPE=0x%X", subType),
-                        entry("VERSION=%d", version),
-                        entry("DATA_LENGTH=%lu\n", data.size()));
+        lg2::error("Failed parsing UserData.  Error = {ERROR}, "
+                   "component ID = {COMP_ID}, subtype = {SUBTYPE}, "
+                   "version = {VERSION}, data length = {LEN}",
+                   "ERROR", e, "COMP_ID", componentID, "SUBTYPE", subType,
+                   "VERSION", version, "LEN", data.size());
     }
 
     return std::nullopt;