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/dbus_zone.cpp b/control/json/dbus_zone.cpp
index a8cbe01..c1cf891 100644
--- a/control/json/dbus_zone.cpp
+++ b/control/json/dbus_zone.cpp
@@ -23,17 +23,15 @@
#include <cereal/archives/json.hpp>
#include <cereal/cereal.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
#include <algorithm>
#include <filesystem>
-#include <format>
#include <fstream>
namespace phosphor::fan::control::json
{
-using namespace phosphor::logging;
namespace fs = std::filesystem;
DBusZone::DBusZone(const Zone& zone) :
@@ -90,11 +88,9 @@
// Include possible exception when removing file, otherwise ec = 0
std::error_code ec;
fs::remove(path, ec);
- log<level::ERR>(
- std::format("Unable to restore persisted `Current` thermal mode "
- "property ({}, ec: {})",
- e.what(), ec.value())
- .c_str());
+ lg2::error("Unable to restore persisted `Current` thermal mode "
+ "property ({ERROR}, ec: {ERROR_CODE})",
+ "ERROR", e, "ERROR_CODE", ec.value());
current = ThermalModeIntf::current();
}