summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2018-10-19 09:19:39 -0700
committerPatrick Venture <venture@google.com>2018-10-19 09:22:28 -0700
commit07f635c82d332e4c469ace59835d2777ca00edb5 (patch)
treeb6d97bf973d5f6474faf77cc7b0cc7510861ecf4
parent1012b4bf4d380ce226e43a6cdeba48e4b480cfce (diff)
downloadipmi-fru-parser-07f635c82d332e4c469ace59835d2777ca00edb5.zip
ipmi-fru-parser-07f635c82d332e4c469ace59835d2777ca00edb5.tar.gz
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>
-rw-r--r--readeeprom.cpp7
1 files changed, 5 insertions, 2 deletions
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 @@ int main(int argc, char** argv)
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
{
OpenPOWER on IntegriCloud