Reducing IPMI logging footprint

-host-ipmid is very noisy in terms of journal logging. A small step
towards cleaning that up.
-Also converted printfs to phosphor-logging.

Partially Resolves openbmc/openbmc#2507

Change-Id: I749c19c18d1cabf6f0216830c8cb0a08ee43d6de
Signed-off-by: Aditya Saripalli <aditya0124@gmail.com>
Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
diff --git a/storagehandler.cpp b/storagehandler.cpp
index b222fa7..d1392e6 100644
--- a/storagehandler.cpp
+++ b/storagehandler.cpp
@@ -79,7 +79,6 @@
                               ipmi_request_t request, ipmi_response_t response,
                               ipmi_data_len_t data_len, ipmi_context_t context)
 {
-    printf("Handling STORAGE WILDCARD Netfn:[0x%X], Cmd:[0x%X]\n",netfn, cmd);
     // Status code.
     ipmi_ret_t rc = IPMI_CC_INVALID;
     *data_len = 0;
@@ -435,8 +434,6 @@
     uint64_t host_time_usec = 0;
     uint32_t resp = 0;
 
-    printf("IPMI Handling GET-SEL-TIME\n");
-
     try
     {
         sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
@@ -472,8 +469,8 @@
         return IPMI_CC_UNSPECIFIED_ERROR;
     }
 
-    printf("Host time: %" PRIu64 ", %s",
-           host_time_usec, getTimeString(host_time_usec));
+    log<level::DEBUG>("Host time:",
+                      entry("HOST_TIME=%s", getTimeString(host_time_usec)));
 
     // Time is really long int but IPMI wants just uint32. This works okay until
     // the number of seconds since 1970 overflows uint32 size.. Still a whole
@@ -499,15 +496,9 @@
     uint32_t secs = *static_cast<uint32_t*>(request);
     *data_len = 0;
 
-    printf("Handling Set-SEL-Time:[0x%X], Cmd:[0x%X], Data:[0x%X]\n",
-           netfn, cmd, secs);
-
     secs = le32toh(secs);
     microseconds usec{seconds(secs)};
 
-    printf("To Set host time: %" PRIu64 ", %s",
-           usec.count(), getTimeString(usec.count()));
-
     try
     {
         sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
@@ -554,8 +545,6 @@
     if( ++g_sel_reserve == 0)
         g_sel_reserve = 1;
 
-    printf("IPMI Handling RESERVE-SEL 0x%04x\n", g_sel_reserve);
-
     *data_len = sizeof(g_sel_reserve);
 
     // Pack the actual response
@@ -575,8 +564,6 @@
 
     recordid = ((uint16_t)p->eventdata[1] << 8) | p->eventdata[2];
 
-    printf("IPMI Handling ADD-SEL for record 0x%04x\n", recordid);
-
     *data_len = sizeof(g_sel_reserve);
 
     // Pack the actual response
@@ -703,57 +690,44 @@
 void register_netfn_storage_functions()
 {
     // <Wildcard Command>
-    printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_STORAGE, IPMI_CMD_WILDCARD);
     ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_WILDCARD, NULL, ipmi_storage_wildcard,
                            PRIVILEGE_USER);
 
     // <Get SEL Info>
-    printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_STORAGE, IPMI_CMD_GET_SEL_INFO);
     ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_SEL_INFO, NULL, getSELInfo,
                            PRIVILEGE_USER);
 
     // <Get SEL Time>
-    printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_STORAGE, IPMI_CMD_GET_SEL_TIME);
     ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_SEL_TIME, NULL, ipmi_storage_get_sel_time,
                            PRIVILEGE_USER);
 
     // <Set SEL Time>
-    printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_STORAGE, IPMI_CMD_SET_SEL_TIME);
     ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_SET_SEL_TIME, NULL, ipmi_storage_set_sel_time,
                            PRIVILEGE_OPERATOR);
 
     // <Reserve SEL>
-    printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_STORAGE, IPMI_CMD_RESERVE_SEL);
     ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_RESERVE_SEL, NULL, ipmi_storage_reserve_sel,
                            PRIVILEGE_USER);
 
     // <Get SEL Entry>
-    printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_STORAGE, IPMI_CMD_GET_SEL_ENTRY);
     ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_SEL_ENTRY, NULL, getSELEntry,
                            PRIVILEGE_USER);
 
     // <Delete SEL Entry>
-    printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_STORAGE, IPMI_CMD_DELETE_SEL);
     ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_DELETE_SEL, NULL, deleteSELEntry,
                            PRIVILEGE_OPERATOR);
 
     // <Add SEL Entry>
-    printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_STORAGE, IPMI_CMD_ADD_SEL);
     ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_ADD_SEL, NULL, ipmi_storage_add_sel,
                            PRIVILEGE_OPERATOR);
     // <Clear SEL>
-    printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_STORAGE, IPMI_CMD_CLEAR_SEL);
     ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_CLEAR_SEL, NULL, clearSEL,
                            PRIVILEGE_OPERATOR);
     // <Get FRU Inventory Area Info>
-    printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n", NETFUN_STORAGE,
-            IPMI_CMD_GET_FRU_INV_AREA_INFO);
     ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_FRU_INV_AREA_INFO, NULL,
             ipmi_storage_get_fru_inv_area_info, PRIVILEGE_OPERATOR);
 
     // <Add READ FRU Data
-    printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n", NETFUN_STORAGE,
-            IPMI_CMD_READ_FRU_DATA);
     ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_READ_FRU_DATA, NULL,
             ipmi_storage_read_fru_data, PRIVILEGE_OPERATOR);