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: I4aabaafe997e13c10d655a83a9ef0071ad11126e
diff --git a/command/open_session.cpp b/command/open_session.cpp
index 0d82a06..21e0f3f 100644
--- a/command/open_session.cpp
+++ b/command/open_session.cpp
@@ -4,9 +4,7 @@
#include "endian.hpp"
#include "sessions_manager.hpp"
-#include <phosphor-logging/log.hpp>
-
-using namespace phosphor::logging;
+#include <phosphor-logging/lg2.hpp>
namespace command
{
@@ -88,8 +86,8 @@
{
response->status_code =
static_cast<uint8_t>(RAKP_ReturnCode::INSUFFICIENT_RESOURCE);
- log<level::ERR>("openSession : Problem opening a session",
- entry("EXCEPTION=%s", e.what()));
+ lg2::error("openSession : Problem opening a session: {ERROR}", "ERROR",
+ e);
return outPayload;
}