Move phosphor-regulators, tools, base dir to lg2
Update the logging API for files in phosphor-regulators, tools,
and the base directory from the older phosphor::logging::log
style of journal traces to the newer lg2::log style. Also
fix bug involving corruption of string data in PMBus class.
Tested:
* Verified journal traces worked correctly in simulation
and produced correct journalctl key-value pairs.
* Temporarily modified both json configs and source code to
force various messages, and verified their presence in the
journalctl output.
* Verify that change in PMBus class correctly fixed corrupted
string data by building and running a temporary executable
with the change included.
Change-Id: I9c3e380bf2103c5ddc051a5dc90ba2c0d3f38796
Signed-off-by: Anwaar Hadi <anwaar.hadi@ibm.com>
diff --git a/tools/power-utils/model.cpp b/tools/power-utils/model.cpp
index 7bfda66..507e585 100644
--- a/tools/power-utils/model.cpp
+++ b/tools/power-utils/model.cpp
@@ -22,7 +22,7 @@
#include "utils.hpp"
#include <nlohmann/json.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
#include <exception>
#include <format>
@@ -153,7 +153,7 @@
}
catch (const std::exception& e)
{
- log<level::ERR>(std::format("Error: {}", e.what()).c_str());
+ lg2::error("Error in getModel: {ERROR}", "ERROR", e);
}
return model;
}