Switch to lg2 for logging
After enabling C++20, lg2 is preferred for logging. This patch replaces
all phosphor::logging::log calls to lg2 calls.
Tested:
Build pass.
Change-Id: Ic37bc36f43c2b3a1c61b1328af95e3a41c8d6d40
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
diff --git a/phosphor-ldap-config/ldap_mapper_serialize.cpp b/phosphor-ldap-config/ldap_mapper_serialize.cpp
index 66cea37..2842ba2 100644
--- a/phosphor-ldap-config/ldap_mapper_serialize.cpp
+++ b/phosphor-ldap-config/ldap_mapper_serialize.cpp
@@ -4,7 +4,7 @@
#include <cereal/archives/binary.hpp>
#include <cereal/types/string.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
#include <fstream>
@@ -18,8 +18,6 @@
namespace ldap
{
-using namespace phosphor::logging;
-
/** @brief Function required by Cereal to perform serialization.
*
* @tparam Archive - Cereal archive type (binary in this case).
@@ -82,13 +80,15 @@
}
catch (const cereal::Exception& e)
{
- log<level::ERR>(e.what());
+ lg2::error("Failed to deserialize {FILE}: {ERR}", "FILE", path, "ERR",
+ e);
fs::remove(path);
return false;
}
catch (const std::length_error& e)
{
- log<level::ERR>(e.what());
+ lg2::error("Failed to deserialize {FILE}: {ERR}", "FILE", path, "ERR",
+ e);
fs::remove(path);
return false;
}