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/epoch_base.cpp b/epoch_base.cpp
index 8f51f41..a336573 100644
--- a/epoch_base.cpp
+++ b/epoch_base.cpp
@@ -2,7 +2,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/Time/error.hpp>
#include <iomanip>
@@ -48,7 +48,7 @@
}
catch (const sdbusplus::exception::exception& ex)
{
- log<level::ERR>("Error in setting system time");
+ lg2::error("Error in setting system time: {ERROR}", "ERROR", ex);
using namespace xyz::openbmc_project::Time;
elog<FailedError>(Failed::REASON(ex.what()));
}