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/gpio.cpp b/gpio.cpp
index 81bc4f5..265ac74 100644
--- a/gpio.cpp
+++ b/gpio.cpp
@@ -20,7 +20,7 @@
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
#include <cassert>
@@ -48,7 +48,7 @@
if (rc < 0)
{
auto e = errno;
- log<level::ERR>("Failed GET_LINE_VALUES ioctl", entry("ERRNO=%d", e));
+ lg2::error("Failed GET_LINE_VALUES ioctl ERRNO={ERRNO}", "ERRNO", e);
elog<InternalFailure>();
}
@@ -68,7 +68,7 @@
if (rc == -1)
{
auto e = errno;
- log<level::ERR>("Failed SET_LINE_VALUES ioctl", entry("ERRNO=%d", e));
+ lg2::error("Failed SET_LINE_VALUES ioctl ERRNO={ERRNO}", "ERRNO", e);
elog<InternalFailure>();
}
}
@@ -85,9 +85,8 @@
if (fd() == -1)
{
auto e = errno;
- log<level::ERR>("Failed opening GPIO device",
- entry("DEVICE=%s", device.c_str()),
- entry("ERRNO=%d", e));
+ lg2::error("Failed opening GPIO device DEVICE={DEVICE} ERRNO={ERRNO}",
+ "DEVICE", device, "ERRNO", e);
elog<InternalFailure>();
}
@@ -112,8 +111,8 @@
if (rc == -1)
{
auto e = errno;
- log<level::ERR>("Failed GET_LINEHANDLE ioctl", entry("GPIO=%d", gpio),
- entry("ERRNO=%d", e));
+ lg2::error("Failed GET_LINEHANDLE ioctl GPIO={GPIO} ERRNO={ERRNO}",
+ "GPIO", gpio, "ERRNO", e);
elog<InternalFailure>();
}