lg2: convert state-manager
This converts the rest of phosphor-state-manager over to the lg2
interface.
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I3878ec950b6a2b1ada93544cc021cecf14edfb46
diff --git a/hypervisor_state_manager.cpp b/hypervisor_state_manager.cpp
index b3afc0c..d0fd193 100644
--- a/hypervisor_state_manager.cpp
+++ b/hypervisor_state_manager.cpp
@@ -2,10 +2,8 @@
#include "hypervisor_state_manager.hpp"
-#include <fmt/format.h>
-
#include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
#include <sdbusplus/exception.hpp>
#include <sdbusplus/server.hpp>
@@ -21,20 +19,21 @@
namespace manager
{
+PHOSPHOR_LOG2_USING;
+
// When you see server:: you know we're referencing our base class
namespace server = sdbusplus::xyz::openbmc_project::State::server;
using namespace phosphor::logging;
server::Host::Transition Hypervisor::requestedHostTransition(Transition value)
{
- log<level::INFO>(fmt::format("Hypervisor state transition request of {}",
- convertForMessage(value))
- .c_str());
+ info("Hypervisor state transition request of {TRAN_REQUEST}",
+ "TRAN_REQUEST", value);
// Only support the transition to On
if (value != server::Host::Transition::On)
{
- log<level::ERR>("Hypervisor state only supports a transition to On");
+ error("Hypervisor state only supports a transition to On");
// TODO raise appropriate error exception
return server::Host::Transition::Off;
}
@@ -47,9 +46,7 @@
server::Host::HostState Hypervisor::currentHostState(HostState value)
{
- log<level::INFO>(
- fmt::format("Change to Hypervisor State: {}", convertForMessage(value))
- .c_str());
+ info("Change to Hypervisor State: {HYP_STATE}", "HYP_STATE", value);
return server::Host::currentHostState(value);
}
@@ -60,8 +57,7 @@
void Hypervisor::updateCurrentHostState(std::string& bootProgress)
{
- log<level::DEBUG>(
- fmt::format("New BootProgress: {}", bootProgress).c_str());
+ debug("New BootProgress: {BOOTPROGRESS}", "BOOTPROGRESS", bootProgress);
if (bootProgress == "xyz.openbmc_project.State.Boot.Progress."
"ProgressStages.SystemInitComplete")