ipmb: Convert logging to lg2
Change-Id: Ic7984c1ad6b5553e2ea2c7a9d09619051d181bd1
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/src/ipmb/IpmbSDRSensor.cpp b/src/ipmb/IpmbSDRSensor.cpp
index c23ddea..1952586 100644
--- a/src/ipmb/IpmbSDRSensor.cpp
+++ b/src/ipmb/IpmbSDRSensor.cpp
@@ -1,12 +1,12 @@
#include "IpmbSDRSensor.hpp"
+#include <phosphor-logging/lg2.hpp>
#include <sdbusplus/asio/connection.hpp>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <functional>
-#include <iostream>
#include <memory>
#include <string>
#include <utility>
@@ -35,8 +35,8 @@
const int status = std::get<0>(response);
if (status != 0)
{
- std::cerr << "Error reading from IPMB SDR for host " << hostIndex
- << "\n";
+ lg2::error("Error reading from IPMB SDR for host '{INDEX}'", "INDEX",
+ hostIndex);
return false;
}
return true;
@@ -68,9 +68,9 @@
if (data.size() < sdrInfoDataSize)
{
- std::cerr
- << " IPMB Get SDR Repository Info data is empty for host "
- << self->hostIndex << "\n";
+ lg2::error(
+ "IPMB Get SDR Repository Info data is empty for host '{INDEX}'",
+ "INDEX", self->hostIndex);
return;
}
@@ -111,9 +111,9 @@
if (data.size() < sdrReserveDataSize)
{
- std::cerr
- << " IPMB SDR Reserve Repository data is empty for host "
- << self->hostIndex << "\n";
+ lg2::error(
+ "IPMB SDR Reserve Repository data is empty for host '{INDEX}'",
+ "INDEX", self->hostIndex);
return;
}
uint8_t resrvIDLSB = data[0];
@@ -157,8 +157,8 @@
if (data.size() < sdrSensorDataSize)
{
- std::cerr << "IPMB SDR sensor data is empty for host "
- << self->hostIndex << "\n";
+ lg2::error("IPMB SDR sensor data is empty for host '{INDEX}'",
+ "INDEX", self->hostIndex);
return;
}