convert host-interface.cpp to use lg2
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: Ie43369731c83e4ad5f22a13598a21e1acecee5c9
diff --git a/host-interface.cpp b/host-interface.cpp
index 6500174..7aa36c6 100644
--- a/host-interface.cpp
+++ b/host-interface.cpp
@@ -9,7 +9,7 @@
#include <ipmid-host/cmd.hpp>
#include <ipmid/api.hpp>
#include <ipmid/utils.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
#include <functional>
#include <memory>
@@ -22,8 +22,6 @@
namespace command
{
-using namespace phosphor::logging;
-
// When you see Base:: you know we're referencing our base class
namespace Base = sdbusplus::server::xyz::openbmc_project::control;
@@ -50,9 +48,8 @@
// Called at user request
void Host::execute(Base::Host::Command command)
{
- log<level::DEBUG>(
- "Pushing cmd on to queue",
- entry("CONTROL_HOST_CMD=%s", convertForMessage(command).c_str()));
+ lg2::debug("Pushing cmd on to queue, control host cmd: {CONTROL_HOST_CMD}",
+ "CONTROL_HOST_CMD", convertForMessage(command));
auto cmd = std::make_tuple(ipmiCommand.at(command),
std::bind(&Host::commandStatusHandler, this,
@@ -83,8 +80,9 @@
auto value = status ? Host::FirmwareCondition::Running
: Host::FirmwareCondition::Off;
- log<level::DEBUG>("currentFirmwareCondition:hostAckCallback fired",
- entry("CONTROL_HOST_CMD=%i", value));
+ lg2::debug("currentFirmwareCondition:hostAckCallback fired, "
+ "control host cmd: {CONTROL_HOST_CMD}",
+ "CONTROL_HOST_CMD", value);
*(hostCondition.get()) = value;
return;
@@ -98,7 +96,7 @@
// Timer to ensure this function returns something within a reasonable time
sdbusplus::Timer hostAckTimer([hostCondition]() {
- log<level::DEBUG>("currentFirmwareCondition: timer expired!");
+ lg2::debug("currentFirmwareCondition: timer expired!");
*(hostCondition.get()) = Host::FirmwareCondition::Off;
});
@@ -110,13 +108,12 @@
while (!hostCondition.get()->has_value())
{
- log<level::DEBUG>(
- "currentFirmwareCondition: waiting for host response");
+ lg2::debug("currentFirmwareCondition: waiting for host response");
io->run_for(std::chrono::milliseconds(100));
}
hostAckTimer.stop();
- log<level::DEBUG>("currentFirmwareCondition: hostCondition is ready!");
+ lg2::debug("currentFirmwareCondition: hostCondition is ready!");
return hostCondition.get()->value();
}