readeeprom: use log error instead of fprintf(stderr)
Use log<level::ERR>() instead of fprintf(stderr,...) on failure to
connect to sdbus.
Change-Id: Ie32d4f02c83a2d204ab71f0ab178d60c136dff97
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/readeeprom.cpp b/readeeprom.cpp
index 2f0e666..96a8cc1 100644
--- a/readeeprom.cpp
+++ b/readeeprom.cpp
@@ -5,6 +5,9 @@
#include <cstring>
#include <iostream>
#include <memory>
+#include <phosphor-logging/log.hpp>
+
+using namespace phosphor::logging;
static void exit_with_error(const char* err, char** argv)
{
@@ -58,8 +61,8 @@
rc = sd_bus_open_system(&bus_type);
if (rc < 0)
{
- std::fprintf(stderr, "Failed to connect to system bus: %s\n",
- std::strerror(-rc));
+ log<level::ERR>("Failed to connect to system bus",
+ entry("ERRNO=%s", std::strerror(-rc)));
}
else
{