remove phosphor-logging dependency
This commit removes pldm's dependency on phosphor-logging
and instead uses stdout and stdcerr for logging purpose.This is to
break the build time circular dependency between pldm and
phosphor-logging.
Change-Id: I8cffa3c99eb34efad5f186b3452a86ebadec2074
Signed-off-by: Sampa Misra <sampmisr@in.ibm.com>
diff --git a/oem/ibm/libpldmresponder/file_io_by_type.cpp b/oem/ibm/libpldmresponder/file_io_by_type.cpp
index efe8e37..7a95a6d 100644
--- a/oem/ibm/libpldmresponder/file_io_by_type.cpp
+++ b/oem/ibm/libpldmresponder/file_io_by_type.cpp
@@ -13,8 +13,7 @@
#include <exception>
#include <filesystem>
#include <fstream>
-#include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/log.hpp>
+#include <iostream>
#include <vector>
#include <xyz/openbmc_project/Logging/Entry/server.hpp>
@@ -26,7 +25,6 @@
namespace responder
{
-using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
int FileHandler::transferFileData(const fs::path& path, bool upstream,
@@ -37,17 +35,15 @@
{
if (!fs::exists(path))
{
- log<level::ERR>("File does not exist",
- entry("PATH=%s", path.c_str()));
+ std::cerr << "File does not exist. PATH=" << path.c_str() << "\n";
return PLDM_INVALID_FILE_HANDLE;
}
size_t fileSize = fs::file_size(path);
if (offset >= fileSize)
{
- log<level::ERR>("Offset exceeds file size",
- entry("OFFSET=%d", offset),
- entry("FILE_SIZE=%d", fileSize));
+ std::cerr << "Offset exceeds file size, OFFSET=" << offset
+ << " FILE_SIZE=" << fileSize << "\n";
return PLDM_DATA_OUT_OF_RANGE;
}
if (offset + length > fileSize)
@@ -97,7 +93,7 @@
}
default:
{
- elog<InternalFailure>();
+ throw InternalFailure();
break;
}
}
@@ -109,16 +105,16 @@
{
if (!fs::exists(filePath))
{
- log<level::ERR>("File does not exist", entry("HANDLE=%d", fileHandle),
- entry("PATH=%s", filePath.c_str()));
+ std::cerr << "File does not exist, HANDLE=" << fileHandle
+ << " PATH=" << filePath.c_str() << "\n";
return PLDM_INVALID_FILE_HANDLE;
}
size_t fileSize = fs::file_size(filePath);
if (offset >= fileSize)
{
- log<level::ERR>("Offset exceeds file size", entry("OFFSET=%d", offset),
- entry("FILE_SIZE=%d", fileSize));
+ std::cerr << "Offset exceeds file size, OFFSET=" << offset
+ << " FILE_SIZE=" << fileSize << "\n";
return PLDM_DATA_OUT_OF_RANGE;
}
@@ -138,7 +134,7 @@
stream.read(filePos, length);
return PLDM_SUCCESS;
}
- log<level::ERR>("Unable to read file", entry("FILE=%s", filePath.c_str()));
+ std::cerr << "Unable to read file, FILE=" << filePath.c_str() << "\n";
return PLDM_ERROR;
}