user_channel: switch to lg2

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I80149836f196f01eb09cc874f74eec0d787b5ac5
diff --git a/user_channel/channelcommands.cpp b/user_channel/channelcommands.cpp
index cd0a33b..321526f 100644
--- a/user_channel/channelcommands.cpp
+++ b/user_channel/channelcommands.cpp
@@ -18,12 +18,10 @@
 #include "channel_layer.hpp"
 
 #include <ipmid/api.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
 
 #include <regex>
 
-using namespace phosphor::logging;
-
 namespace ipmi
 {
 
@@ -51,7 +49,7 @@
     if (reserved1 || reserved2 ||
         !isValidPrivLimit(static_cast<uint8_t>(channelPrivLimit)))
     {
-        log<level::DEBUG>("Set channel access - Invalid field in request");
+        lg2::debug("Set channel access - Invalid field in request");
         return responseInvalidFieldRequest();
     }
 
@@ -60,7 +58,8 @@
     if ((getChannelSessionSupport(chNum) == EChannelSessSupported::none) ||
         (!isValidChannel(chNum)))
     {
-        log<level::DEBUG>("Set channel access - No support on channel");
+        lg2::debug("Set channel access - No support on channel: {CHANNEL}",
+                   "CHANNEL", chNum);
         return response(ccActionNotSupportedForChannel);
     }
 
@@ -96,7 +95,7 @@
 
         case reserved:
         default:
-            log<level::DEBUG>("Set channel access - Invalid access set mode");
+            lg2::debug("Set channel access - Invalid access set mode");
             return response(ccAccessModeNotSupportedForChannel);
     }
 
@@ -117,7 +116,7 @@
             break;
         case reserved:
         default:
-            log<level::DEBUG>("Set channel access - Invalid access priv mode");
+            lg2::debug("Set channel access - Invalid access priv mode");
             return response(ccAccessModeNotSupportedForChannel);
     }
 
@@ -126,7 +125,7 @@
         compCode = setChannelAccessPersistData(chNum, chNVData, setNVFlag);
         if (compCode != ccSuccess)
         {
-            log<level::DEBUG>("Set channel access - Failed to set access data");
+            lg2::debug("Set channel access - Failed to set access data");
             return response(compCode);
         }
     }
@@ -136,7 +135,7 @@
         compCode = setChannelAccessData(chNum, chActData, setActFlag);
         if (compCode != ccSuccess)
         {
-            log<level::DEBUG>("Set channel access - Failed to set access data");
+            lg2::debug("Set channel access - Failed to set access data");
             return response(compCode);
         }
     }
@@ -174,14 +173,14 @@
 {
     if (reserved1 || reserved2)
     {
-        log<level::DEBUG>("Get channel access - Invalid field in request");
+        lg2::debug("Get channel access - Invalid field in request");
         return responseInvalidFieldRequest();
     }
 
     if ((types::enum_cast<EChannelActionType>(accessSetMode) == doNotSet) ||
         (types::enum_cast<EChannelActionType>(accessSetMode) == reserved))
     {
-        log<level::DEBUG>("Get channel access - Invalid Access mode");
+        lg2::debug("Get channel access - Invalid Access mode");
         return responseInvalidFieldRequest();
     }
 
@@ -191,7 +190,8 @@
     if ((getChannelSessionSupport(chNum) == EChannelSessSupported::none) ||
         (!isValidChannel(chNum)))
     {
-        log<level::DEBUG>("Get channel access - No support on channel");
+        lg2::debug("Get channel access - No support on channel: {CHANNEL}",
+                   "CHANNEL", chNum);
         return response(ccActionNotSupportedForChannel);
     }
 
@@ -252,7 +252,7 @@
 {
     if (reserved)
     {
-        log<level::DEBUG>("Get channel access - Invalid field in request");
+        lg2::debug("Get channel access - Invalid field in request");
         return responseInvalidFieldRequest();
     }
 
@@ -260,7 +260,8 @@
                                              ctx->channel);
     if (!isValidChannel(chNum))
     {
-        log<level::DEBUG>("Get channel Info - No support on channel");
+        lg2::debug("Get channel Info - No support on channel: {CHANNEL}",
+                   "CHANNEL", chNum);
         return responseInvalidFieldRequest();
     }
 
@@ -268,9 +269,9 @@
     Cc compCode = getChannelInfo(chNum, chInfo);
     if (compCode != ccSuccess)
     {
-        log<level::ERR>("Failed to get channel info",
-                        entry("CHANNEL=%x", chNum),
-                        entry("ERRNO=%x", compCode));
+        lg2::error("Failed to get channel info, channel: {CHANNEL}, "
+                   "errno: {ERRNO}",
+                   "CHANNEL", chNum, "ERRNO", compCode);
         return response(compCode);
     }
 
@@ -329,14 +330,14 @@
 
     if (!doesDeviceExist(chNum) || !isValidChannel(chNum) || reserved)
     {
-        log<level::DEBUG>("Get channel payload - Invalid field in request");
+        lg2::debug("Get channel payload - Invalid field in request");
         return responseInvalidFieldRequest();
     }
 
     // Session support is available in active LAN channels.
     if (getChannelSessionSupport(chNum) == EChannelSessSupported::none)
     {
-        log<level::DEBUG>("Get channel payload - No support on channel");
+        lg2::debug("Get channel payload - No support on channel");
         return response(ccActionNotSupportedForChannel);
     }
     constexpr uint16_t stdPayloadType = standardPayloadBit(PayloadType::IPMI) |
@@ -374,22 +375,19 @@
 
     if (reserved || !isValidChannel(channel))
     {
-        log<level::DEBUG>(
-            "Get channel payload version - Invalid field in request");
+        lg2::debug("Get channel payload version - Invalid field in request");
         return responseInvalidFieldRequest();
     }
 
     if (getChannelSessionSupport(channel) == EChannelSessSupported::none)
     {
-        log<level::DEBUG>(
-            "Get channel payload version - No support on channel");
+        lg2::debug("Get channel payload version - No support on channel");
         return response(payloadTypeNotSupported);
     }
 
     if (!isValidPayloadType(static_cast<PayloadType>(payloadTypeNum)))
     {
-        log<level::ERR>(
-            "Get channel payload version - Payload type unavailable");
+        lg2::error("Get channel payload version - Payload type unavailable");
 
         return response(payloadTypeNotSupported);
     }