convert sensordatahandler to use lg2
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I55ece5e0f6d1d9d7c42f20fbf5ef6495fb879612
diff --git a/sensordatahandler.cpp b/sensordatahandler.cpp
index 1752bd6..45e3835 100644
--- a/sensordatahandler.cpp
+++ b/sensordatahandler.cpp
@@ -40,7 +40,7 @@
}
catch (const InternalFailure& e)
{
- log<level::ERR>("Error in D-Bus call", entry("ERROR=%s", e.what()));
+ lg2::error("Error in D-Bus call: {ERROR}", "ERROR", e);
commit<InternalFailure>();
return IPMI_CC_UNSPECIFIED_ERROR;
}
@@ -211,7 +211,7 @@
const auto& iter = std::get<OffsetValueMap>(property.second).find(data);
if (iter == std::get<OffsetValueMap>(property.second).end())
{
- log<level::ERR>("Invalid event data");
+ lg2::error("Invalid event data");
return IPMI_CC_PARM_OUT_OF_RANGE;
}
msg.append(iter->second.assert);
diff --git a/sensordatahandler.hpp b/sensordatahandler.hpp
index 1ca488b..f111df1 100644
--- a/sensordatahandler.hpp
+++ b/sensordatahandler.hpp
@@ -8,7 +8,7 @@
#include <ipmid/types.hpp>
#include <ipmid/utils.hpp>
#include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
#include <sdbusplus/message/types.hpp>
#include <cmath>
@@ -447,7 +447,7 @@
if (rawData > std::numeric_limits<int8_t>::max() ||
rawData < std::numeric_limits<int8_t>::lowest())
{
- log<level::ERR>("Value out of range");
+ lg2::error("Value out of range");
throw std::out_of_range("Value out of range");
}
setReading(static_cast<int8_t>(rawData), &response);
@@ -457,7 +457,7 @@
if (rawData > std::numeric_limits<uint8_t>::max() ||
rawData < std::numeric_limits<uint8_t>::lowest())
{
- log<level::ERR>("Value out of range");
+ lg2::error("Value out of range");
throw std::out_of_range("Value out of range");
}
setReading(static_cast<uint8_t>(rawData), &response);