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/phosphor-regulators/src/interfaces/manager_interface.cpp b/phosphor-regulators/src/interfaces/manager_interface.cpp
index 81196c1..2c1f530 100644
--- a/phosphor-regulators/src/interfaces/manager_interface.cpp
+++ b/phosphor-regulators/src/interfaces/manager_interface.cpp
@@ -16,7 +16,7 @@
#include "manager_interface.hpp"
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
#include <sdbusplus/exception.hpp>
#include <sdbusplus/sdbus.hpp>
#include <sdbusplus/server.hpp>
@@ -61,8 +61,7 @@
else
{
// The message or context were null
- using namespace phosphor::logging;
- log<level::ERR>("Unable to service Configure method callback");
+ lg2::error("Unable to service Configure method callback");
return -1;
}
@@ -96,8 +95,7 @@
else
{
// The message or context were null
- using namespace phosphor::logging;
- log<level::ERR>("Unable to service Monitor method callback");
+ lg2::error("Unable to service Monitor method callback");
return -1;
}
diff --git a/phosphor-regulators/src/journal.hpp b/phosphor-regulators/src/journal.hpp
index 2199c8c..300ef6f 100644
--- a/phosphor-regulators/src/journal.hpp
+++ b/phosphor-regulators/src/journal.hpp
@@ -17,7 +17,7 @@
#include <systemd/sd-journal.h>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
#include <string>
#include <vector>
@@ -126,8 +126,7 @@
/** @copydoc Journal::logDebug(const std::string&) */
virtual void logDebug(const std::string& message) override
{
- using namespace phosphor::logging;
- log<level::DEBUG>(message.c_str());
+ lg2::debug(message.c_str());
}
/** @copydoc Journal::logDebug(const std::vector<std::string>&) */
@@ -142,8 +141,7 @@
/** @copydoc Journal::logError(const std::string&) */
virtual void logError(const std::string& message) override
{
- using namespace phosphor::logging;
- log<level::ERR>(message.c_str());
+ lg2::error(message.c_str());
}
/** @copydoc Journal::logError(const std::vector<std::string>&) */
@@ -158,8 +156,7 @@
/** @copydoc Journal::logInfo(const std::string&) */
virtual void logInfo(const std::string& message) override
{
- using namespace phosphor::logging;
- log<level::INFO>(message.c_str());
+ lg2::info(message.c_str());
}
/** @copydoc Journal::logInfo(const std::vector<std::string>&) */