ncsi-netlink: Remove phosphor-logging dependency
As a CLI application, ncsi-netlink should use stderr for error messages
instead of phosphor-logging. This commits converts all phosphor-logging
logs calls to std::cerr and removes phosphor_logging_dep in meson file.
Tested:
Build pass.
Change-Id: I02227e31feab080c03d514b65dbeec4059867385
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
diff --git a/src/meson.build b/src/meson.build
index 304db1f..08decbd 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -28,8 +28,6 @@
fmt_dep,
dependency('libnl-3.0'),
dependency('libnl-genl-3.0'),
- phosphor_dbus_interfaces_dep,
- phosphor_logging_dep,
],
install: true,
install_dir: get_option('bindir'))
diff --git a/src/ncsi_util.cpp b/src/ncsi_util.cpp
index ec6074f..06eb254 100644
--- a/src/ncsi_util.cpp
+++ b/src/ncsi_util.cpp
@@ -8,9 +8,7 @@
#include <iomanip>
#include <iostream>
-#include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/log.hpp>
-#include <xyz/openbmc_project/Common/error.hpp>
+#include <vector>
namespace phosphor
{
@@ -19,9 +17,6 @@
namespace ncsi
{
-using namespace phosphor::logging;
-using namespace sdbusplus::xyz::openbmc_project::Common::Error;
-
using CallBack = int (*)(struct nl_msg* msg, void* arg);
namespace internal
@@ -253,7 +248,7 @@
nlSocketPtr socket(nl_socket_alloc(), &::nl_socket_free);
if (socket == nullptr)
{
- log<level::ERR>("Unable to allocate memory for the socket.");
+ std::cerr << "Unable to allocate memory for the socket" << std::endl;
return -ENOMEM;
}
@@ -274,7 +269,7 @@
nlMsgPtr msg(nlmsg_alloc(), &::nlmsg_free);
if (msg == nullptr)
{
- log<level::ERR>("Unable to allocate memory for the message.");
+ std::cerr << "Unable to allocate memory for the message" << std::endl;
return -ENOMEM;
}