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/net_target_decrease.cpp b/control/json/actions/net_target_decrease.cpp
index a9fe8d1..9d423de 100644
--- a/control/json/actions/net_target_decrease.cpp
+++ b/control/json/actions/net_target_decrease.cpp
@@ -21,17 +21,15 @@
#include "group.hpp"
#include <nlohmann/json.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
#include <algorithm>
-#include <format>
#include <variant>
namespace phosphor::fan::control::json
{
using json = nlohmann::json;
-using namespace phosphor::logging;
NetTargetDecrease::NetTargetDecrease(const json& jsonObj,
const std::vector<Group>& groups) :
@@ -122,12 +120,12 @@
else
{
// Unsupported group member type for this action
- log<level::ERR>(
- std::format("Action {}: Unsupported group member type "
- "given. [object = {} : {} : {}]",
- ActionBase::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", ActionBase::getName(), "MEMBER", member,
+ "GROUP_INTERFACE", group.getInterface(),
+ "GROUP_PROPERTY", group.getProperty());
}
}
catch (const std::out_of_range& oore)