logging: switch to lg2
It is recommended to use `phosphor::lg2` to format log, and the
correct `CODE_LINE` and `CODE_FUNC` values can be used in log
tracking.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ic8a400451f96cde5bdb9f47094806bd31adce7d9
diff --git a/settings.cpp b/settings.cpp
index c136c22..1ac0d9e 100644
--- a/settings.cpp
+++ b/settings.cpp
@@ -3,7 +3,7 @@
#include "xyz/openbmc_project/Common/error.hpp"
#include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
namespace settings
{
@@ -38,12 +38,12 @@
}
catch (const sdbusplus::exception::exception& ex)
{
- log<level::ERR>("Failed to invoke GetSubTree method");
+ lg2::error("Failed to invoke GetSubTree method: {ERROR}", "ERROR", ex);
}
if (result.empty())
{
- log<level::ERR>("Invalid response from mapper");
+ lg2::error("Invalid response from mapper");
elog<InternalFailure>();
}
@@ -79,12 +79,12 @@
}
catch (const sdbusplus::exception::exception& ex)
{
- log<level::ERR>("Error in mapper GetObject");
+ lg2::error("Error in mapper GetObject: {ERROR}", "ERROR", ex);
}
if (result.empty())
{
- log<level::ERR>("Invalid response from mapper");
+ lg2::error("Invalid response from mapper");
elog<InternalFailure>();
}