logging: switch to lg2
After switching to C++20, 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: If1cbc1f1eb4ccd02fe2e95f2f09a4fd0b43a0851
diff --git a/errors.cpp b/errors.cpp
index b751107..3712185 100644
--- a/errors.cpp
+++ b/errors.cpp
@@ -15,7 +15,7 @@
*/
#include "errors.hpp"
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
namespace phosphor
{
@@ -25,8 +25,7 @@
{
void InterfaceError::log() const
{
- logging::log<logging::level::ERR>(
- what(), phosphor::logging::entry("INTERFACE=%s", interface.c_str()));
+ lg2::error("{INTF} unrecognized", "INTF", interface);
}
} // namespace manager
} // namespace inventory