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/manager.cpp b/control/json/manager.cpp
index a74b1b8..99b87da 100644
--- a/control/json/manager.cpp
+++ b/control/json/manager.cpp
@@ -94,8 +94,8 @@
_loadAllowed = false;
_profiles.swap(profiles);
_activeProfiles.swap(activeProfiles);
- log<level::ERR>("Error reloading configs, no changes made",
- entry("LOAD_ERROR=%s", re.what()));
+ lg2::error("Error reloading configs, no changes made: {LOAD_ERROR}",
+ "LOAD_ERROR", re);
FlightRecorder::instance().log(
"main", std::format("Error reloading configs, no changes made: {}",
re.what()));
@@ -116,7 +116,7 @@
std::ofstream file{Manager::dumpFile};
if (!file)
{
- log<level::ERR>("Could not open file for fan dump");
+ lg2::error("Could not open file for fan dump");
return;
}
@@ -541,11 +541,9 @@
if (service.empty())
{
// Log service not found for object
- log<level::DEBUG>(
- std::format(
- "Unable to get service name for path {}, interface {}",
- path, intf)
- .c_str());
+ lg2::debug(
+ "Unable to get service name for path {PATH}, interface {INTERFACE}",
+ "PATH", path, "INTERFACE", intf);
return;
}
}