Print the errno from a fail in the journal

When a file access fails, print the errno of the failure in the same
journal entry the filename is already printed.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I20d268f563cf1bbfa2a5f9780c02998d075f5275
diff --git a/fan_pwm.cpp b/fan_pwm.cpp
index 7675b10..91ba57d 100644
--- a/fan_pwm.cpp
+++ b/fan_pwm.cpp
@@ -41,7 +41,9 @@
         auto file =
             sysfs::make_sysfs_path(_ioAccess->path(), _type, _id, empty);
 
-        log<level::INFO>(fmt::format("Failing sysfs file: {}", file).c_str());
+        log<level::INFO>(fmt::format("Failing sysfs file: {} errno: {}", file,
+                                     e.code().value())
+                             .c_str());
 
         exit(EXIT_FAILURE);
     }
diff --git a/fan_speed.cpp b/fan_speed.cpp
index e990410..9ce625b 100644
--- a/fan_speed.cpp
+++ b/fan_speed.cpp
@@ -41,8 +41,9 @@
             auto file = sysfs::make_sysfs_path(_ioAccess->path(), _type, _id,
                                                entry::target);
 
-            log<level::INFO>(
-                fmt::format("Failing sysfs file: {}", file).c_str());
+            log<level::INFO>(fmt::format("Failing sysfs file: {} errno: {}",
+                                         file, e.code().value())
+                                 .c_str());
 
             exit(EXIT_FAILURE);
         }
@@ -76,8 +77,9 @@
             auto fullPath = sysfs::make_sysfs_path(_ioAccess->path(), type::pwm,
                                                    _id, entry::enable);
 
-            log<level::INFO>(
-                fmt::format("Failing sysfs file: {}", fullPath).c_str());
+            log<level::INFO>(fmt::format("Failing sysfs file: {} errno: {}",
+                                         fullPath, e.code().value())
+                                 .c_str());
 
             exit(EXIT_FAILURE);
         }
diff --git a/mainloop.cpp b/mainloop.cpp
index b694261..3e7e0bf 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -240,7 +240,9 @@
             xyz::openbmc_project::Sensor::Device::ReadFailure::
                 CALLOUT_DEVICE_PATH(_devPath.c_str()));
 
-        log<level::INFO>(fmt::format("Failing sysfs file: {}", file).c_str());
+        log<level::INFO>(fmt::format("Failing sysfs file: {} errno: {}", file,
+                                     e.code().value())
+                             .c_str());
         exit(EXIT_FAILURE);
     }
     auto sensorValue = valueInterface->value();
@@ -530,8 +532,9 @@
                 xyz::openbmc_project::Sensor::Device::ReadFailure::
                     CALLOUT_DEVICE_PATH(_devPath.c_str()));
 
-            log<level::INFO>(
-                fmt::format("Failing sysfs file: {}", file).c_str());
+            log<level::INFO>(fmt::format("Failing sysfs file: {} errno: {}",
+                                         file, e.code().value())
+                                 .c_str());
 
             exit(EXIT_FAILURE);
         }
diff --git a/sensor.cpp b/sensor.cpp
index aa2ff35..3c1bbe5 100644
--- a/sensor.cpp
+++ b/sensor.cpp
@@ -230,8 +230,9 @@
                 metadata::CALLOUT_ERRNO(e.code().value()),
                 metadata::CALLOUT_DEVICE_PATH(_devPath.c_str()));
 
-            log<level::INFO>(
-                fmt::format("Failing sysfs file: {}", sysfsFullPath).c_str());
+            log<level::INFO>(fmt::format("Failing sysfs file: {} errno {}",
+                                         sysfsFullPath, e.code().value())
+                                 .c_str());
         }
     }
 
diff --git a/targets.hpp b/targets.hpp
index c1a2feb..51e98a5 100644
--- a/targets.hpp
+++ b/targets.hpp
@@ -154,9 +154,9 @@
                     metadata::CALLOUT_ERRNO(e.code().value()),
                     metadata::CALLOUT_DEVICE_PATH(devPath.c_str()));
 
-                log<level::INFO>(
-                    fmt::format("Failing sysfs file: {}", sysfsFullPath)
-                        .c_str());
+                log<level::INFO>(fmt::format("Failing sysfs file: {} errno: {}",
+                                             sysfsFullPath, e.code().value())
+                                     .c_str());
             }
 
             static constexpr bool deferSignals = true;