Move the control application to lg2
Update the logging API used for files in phosphor-fan-presence/control
from the older phosphor::logging::log to the more recent lg2::log.
Tested:
* Verified journal traces worked correctly in simulation.
* Modified json to force various property errors and verified
correct key/value pairs in the journalctl output.
Change-Id: If1ac33b90abe2a9baae6f3cc788863bd514fa80e
Signed-off-by: Anwaar Hadi <anwaar.hadi@ibm.com>
diff --git a/control/json/actions/request_target_base.cpp b/control/json/actions/request_target_base.cpp
index f52a19b..186e611 100644
--- a/control/json/actions/request_target_base.cpp
+++ b/control/json/actions/request_target_base.cpp
@@ -20,16 +20,14 @@
#include "group.hpp"
#include <nlohmann/json.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
#include <algorithm>
-#include <format>
namespace phosphor::fan::control::json
{
using json = nlohmann::json;
-using namespace phosphor::logging;
RequestTargetBase::RequestTargetBase(const json& jsonObj,
const std::vector<Group>& groups) :
@@ -73,12 +71,12 @@
else
{
// Unsupported group member type for this action
- log<level::ERR>(
- std::format("Action {}: Unsupported group member type "
- "given. [object = {} : {} : {}]",
- getName(), member, group.getInterface(),
- group.getProperty())
- .c_str());
+ lg2::error(
+ "Action {ACTION_NAME}: Unsupported group member type "
+ "given. [object = {MEMBER} : {GROUP_INTERFACE} : {GROUP_PROPERTY}]",
+ "ACTION_NAME", getName(), "MEMBER", member,
+ "GROUP_INTERFACE", group.getInterface(),
+ "GROUP_PROPERTY", group.getProperty());
}
}
catch (const std::out_of_range& oore)