Patch #2 Reducing IPMI logging footprint

net-ipmid is noisy in terms of journal logging. A small step towards
cleaning that up.

Partially Resolves openbmc/openbmc#2507

Change-Id: I78e0286fb37086373c86dca276c0948f4595cb0a
Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
diff --git a/command/channel_auth.cpp b/command/channel_auth.cpp
index 6b757a6..fbb7242 100644
--- a/command/channel_auth.cpp
+++ b/command/channel_auth.cpp
@@ -10,8 +10,6 @@
 std::vector<uint8_t> GetChannelCapabilities(
         const std::vector<uint8_t>& inPayload, const message::Handler& handler)
 {
-    std::cout << ">> GetChannelCapabilities\n";
-
     std::vector<uint8_t> outPayload(sizeof(GetChannelCapabilitiesResp));
     auto response = reinterpret_cast<GetChannelCapabilitiesResp*>
                     (outPayload.data());
@@ -46,8 +44,6 @@
     response->oemID[1] = 0;
     response->oemID[2] = 0;
     response->oemAuxillary = 0;
-
-    std::cout << "<< GetChannelCapabilities\n";
     return outPayload;
 }
 
diff --git a/command/open_session.cpp b/command/open_session.cpp
index f33de3c..6e08d1a 100644
--- a/command/open_session.cpp
+++ b/command/open_session.cpp
@@ -12,7 +12,6 @@
 std::vector<uint8_t> openSession(const std::vector<uint8_t>& inPayload,
                                  const message::Handler& handler)
 {
-    std::cout << ">> openSession\n";
 
     std::vector<uint8_t> outPayload(sizeof(OpenSessionResponse));
     auto request = reinterpret_cast<const OpenSessionRequest*>(inPayload.data());
@@ -89,8 +88,6 @@
 
     // Session state is Setup in progress
     session->state = session::State::SETUP_IN_PROGRESS;
-
-    std::cout << "<< openSession\n";
     return outPayload;
 }
 
diff --git a/command/rakp12.cpp b/command/rakp12.cpp
index e5ea3a7..5963cef 100644
--- a/command/rakp12.cpp
+++ b/command/rakp12.cpp
@@ -17,8 +17,6 @@
 std::vector<uint8_t> RAKP12(const std::vector<uint8_t>& inPayload,
                             const message::Handler& handler)
 {
-    std::cout << ">> RAKP12\n";
-
     std::vector<uint8_t> outPayload(sizeof(RAKP2response));
     auto request = reinterpret_cast<const RAKP1request*>(inPayload.data());
     auto response = reinterpret_cast<RAKP2response*>(outPayload.data());
@@ -149,8 +147,6 @@
 
     // Insert the HMAC output into the payload
     outPayload.insert(outPayload.end(), output.begin(), output.end());
-
-    std::cout << "<< RAKP12\n";
     return outPayload;
 }
 
diff --git a/command/rakp34.cpp b/command/rakp34.cpp
index 24deac0..71b1e52 100644
--- a/command/rakp34.cpp
+++ b/command/rakp34.cpp
@@ -67,7 +67,6 @@
 std::vector<uint8_t> RAKP34(const std::vector<uint8_t>& inPayload,
                             const message::Handler& handler)
 {
-    std::cout << ">> RAKP34\n";
 
     std::vector<uint8_t> outPayload(sizeof(RAKP4response));
     auto request = reinterpret_cast<const RAKP3request*>(inPayload.data());
@@ -266,8 +265,6 @@
     applyCryptAlgo(session->getBMCSessionID());
 
     session->state = session::State::ACTIVE;
-
-    std::cout << "<< RAKP34\n";
     return outPayload;
 }
 
diff --git a/command/session_cmds.cpp b/command/session_cmds.cpp
index 706cfcd..e199532 100644
--- a/command/session_cmds.cpp
+++ b/command/session_cmds.cpp
@@ -12,7 +12,6 @@
 std::vector<uint8_t> setSessionPrivilegeLevel(
         const std::vector<uint8_t>& inPayload, const message::Handler& handler)
 {
-    std::cout << ">> setSessionPrivilegeLevel\n";
 
     std::vector<uint8_t> outPayload(sizeof(SetSessionPrivLevelResp));
     auto request = reinterpret_cast<const SetSessionPrivLevelReq*>
@@ -40,16 +39,12 @@
         // Requested level exceeds Channel and/or User Privilege Limit
         response->completionCode = IPMI_CC_EXCEEDS_USER_PRIV;
     }
-
-    std::cout << "<< setSessionPrivilegeLevel\n";
     return outPayload;
 }
 
 std::vector<uint8_t> closeSession(const std::vector<uint8_t>& inPayload,
                                   const message::Handler& handler)
 {
-    std::cout << ">> closeSession\n";
-
     std::vector<uint8_t> outPayload(sizeof(CloseSessionResponse));
     auto request = reinterpret_cast<const CloseSessionRequest*>
                    (inPayload.data());
@@ -73,8 +68,6 @@
             response->completionCode = IPMI_CC_INVALID_SESSIONID;
         }
     }
-
-    std::cout << "<< closeSession\n";
     return outPayload;
 }
 
diff --git a/command_table.cpp b/command_table.cpp
index 7a6e2df..07ad157 100644
--- a/command_table.cpp
+++ b/command_table.cpp
@@ -6,6 +6,11 @@
 #include "message_handler.hpp"
 #include "message_parsers.hpp"
 #include "sessions_manager.hpp"
+#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/elog-errors.hpp>
+#include "xyz/openbmc_project/Common/error.hpp"
+
+using namespace phosphor::logging;
 
 namespace command
 {
@@ -16,14 +21,11 @@
 
     if (command)
     {
-        std::cout << "I> Already Registered, Skipping " << std::hex
-                  << inCommand.command << "\n";
+        log<level::DEBUG>("Already Registered", phosphor::logging::entry(
+            "SKIPPED_ENTRY=0x%x", uint32_t(inCommand.command)));
         return;
     }
 
-    std::cout << "I> Registering Command" << std::hex
-              << inCommand.command << "\n";
-
     command = std::move(entry);
 }
 
diff --git a/provider_registration.cpp b/provider_registration.cpp
index 98945a4..1a9b038 100644
--- a/provider_registration.cpp
+++ b/provider_registration.cpp
@@ -50,7 +50,6 @@
     {
         handlerPath = providerLibPath;
         handlerPath += handlerList[numLibs]->d_name;
-        std::cout << "Registering handler: " << handlerPath << "\n";
 
         auto lib_handler = dlopen(handlerPath.c_str(), RTLD_NOW);