netipmid: replace std::cerr with phosphor::logging calls
This is part of a cleanup and standardization effort of code to get
existing code up to date.
Change-Id: I0c982ef8d7afa2f56a9cd204bb8ac3112769641c
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/main.cpp b/main.cpp
index c3f3dfd..abb7958 100644
--- a/main.cpp
+++ b/main.cpp
@@ -17,11 +17,13 @@
#include <systemd/sd-event.h>
#include <unistd.h>
-#include <iostream>
+#include <phosphor-logging/log.hpp>
#include <sdbusplus/asio/connection.hpp>
#include <sdbusplus/timer.hpp>
#include <tuple>
+using namespace phosphor::logging;
+
// Tuple of Global Singletons
static auto io = std::make_shared<boost::asio::io_context>();
session::Manager manager;
@@ -117,8 +119,8 @@
auto rc = sd_bus_default_system(&bus);
if (rc < 0)
{
- std::cerr << "Failed to connect to system bus:" << strerror(-rc)
- << "\n";
+ log<level::ERR>("Failed to connect to system bus",
+ entry("ERROR=%s", strerror(-rc)));
return rc;
}
@@ -126,7 +128,8 @@
rc = sd_event_default(&events);
if (rc < 0)
{
- std::cerr << "Failure to create sd_event" << strerror(-rc) << "\n";
+ log<level::ERR>("Failure to create sd_event",
+ entry("ERROR=%s", strerror(-rc)));
return EXIT_FAILURE;
}
sdbusp = std::make_shared<sdbusplus::asio::connection>(*io, bus);