Port phosphor::logging to lg2
Added patch which ports all the phosphor::log to lg2
Tested:
1) No crash is seen when smbios-mdr is loaded
Change-Id: If6d1f24eb34be7370382c18b76eff7897e305226
Signed-off-by: Prithvi Pai <ppai@nvidia.com>
diff --git a/src/dimm.cpp b/src/dimm.cpp
index d0c8b91..ce63f4f 100644
--- a/src/dimm.cpp
+++ b/src/dimm.cpp
@@ -20,6 +20,7 @@
#include <boost/algorithm/string.hpp>
#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/lg2.hpp>
#include <fstream>
#include <iostream>
@@ -126,8 +127,7 @@
dataIn = getSMBIOSTypePtr(dataIn, physicalMemoryArrayType);
if (dataIn == nullptr)
{
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "Failed to get SMBIOS table type-16 data.");
+ lg2::error("Failed to get SMBIOS table type-16 data.");
return;
}
@@ -149,9 +149,9 @@
dataIn = smbiosNextPtr(dataIn);
}
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "Failed find the corresponding SMBIOS table type-16 data for dimm:",
- phosphor::logging::entry("DIMM:%d", dimmNum));
+ lg2::error(
+ "Failed find the corresponding SMBIOS table type-16 data for dimm: {DIMM}",
+ "DIMM", dimmNum);
}
EccType Dimm::ecc(EccType value)
@@ -246,9 +246,8 @@
memoryController(0);
slot(0);
channel(0);
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "Failed find the corresponding table for dimm ",
- phosphor::logging::entry("DIMM:%s", deviceLocator.c_str()));
+ lg2::error("Failed find the corresponding table for dimm {DIMM}",
+ "DIMM", deviceLocator.c_str());
}
}
else
@@ -265,9 +264,8 @@
}
catch (const sdbusplus::exception_t& ex)
{
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "std::stoi operation failed ",
- phosphor::logging::entry("ERROR=%s", ex.what()));
+ lg2::error("std::stoi operation failed {ERROR}", "ERROR",
+ ex.what());
}
}
}
@@ -473,17 +471,15 @@
if (!memoryLocationFile.is_open())
{
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "config JSON file not found, FILENAME ",
- phosphor::logging::entry("%s", filename));
+ lg2::error("config JSON file not found, FILENAME {FILENAME}",
+ "FILENAME", filename);
return {};
}
auto data = Json::parse(memoryLocationFile, nullptr, false);
if (data.is_discarded())
{
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "config readings JSON parser failure");
+ lg2::error("config readings JSON parser failure");
return {};
}