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/serialize.hpp b/serialize.hpp
index 4bae397..ace13c4 100644
--- a/serialize.hpp
+++ b/serialize.hpp
@@ -3,7 +3,7 @@
#include "config.h"
#include <cereal/archives/json.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
#include <filesystem>
#include <fstream>
@@ -88,7 +88,7 @@
}
catch (const cereal::Exception& e)
{
- phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
+ lg2::error("Deserialization failed: {ERROR}", "ERROR", e);
fs::remove(p);
}
}