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/utils.hpp b/utils.hpp
index af83d38..9639cbf 100644
--- a/utils.hpp
+++ b/utils.hpp
@@ -2,7 +2,7 @@
#include "types.hpp"
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
#include <sdbusplus/bus.hpp>
namespace phosphor
@@ -12,8 +12,6 @@
namespace utils
{
-using namespace phosphor::logging;
-
/** @brief The template function to get property from the requested dbus path
*
* @param[in] bus - The Dbus bus object
@@ -40,9 +38,10 @@
}
catch (const sdbusplus::exception::exception& ex)
{
- log<level::ERR>("GetProperty call failed", entry("PATH=%s", path),
- entry("INTERFACE=%s", interface),
- entry("PROPERTY=%s", propertyName));
+ lg2::error("GetProperty call failed, path:{PATH}, interface:{INTF}, "
+ "propertyName:{NAME}, error:{ERROR}",
+ "PATH", path, "INTF", interface, "NAME", propertyName,
+ "ERROR", ex);
throw std::runtime_error("GetProperty call failed");
}
}