Print the failing filename in the journal msg

Instead of hiding the name of the file that had the failed access in the
journal metadata, put it in the journal message so debug is easier.

Uses the fmt library.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ice3958ffb576adf0b06ef7eab7d2fc03aa526819
diff --git a/Makefile.am b/Makefile.am
index 378c565..706a6cc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -48,7 +48,8 @@
 	$(PHOSPHOR_LOGGING_LIBS) \
 	$(GPIOPLUS_LIBS) \
 	$(STDPLUS_LIBS) \
-	$(CODE_COVERAGE_LIBS)
+	$(CODE_COVERAGE_LIBS) \
+	$(FMT_LIBS)
 libhwmon_la_CXXFLAGS = \
 	$(SDBUSPLUS_CFLAGS) \
 	$(SDEVENTPLUS_CFLAGS) \
diff --git a/configure.ac b/configure.ac
index 977594d..5e4bbdd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,7 @@
 PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging])
 PKG_CHECK_MODULES([GPIOPLUS], [gpioplus])
 PKG_CHECK_MODULES([STDPLUS], [stdplus])
+PKG_CHECK_MODULES([FMT], [fmt])
 # We need the header only CLI library
 AC_CHECK_HEADERS(
     [CLI/CLI.hpp],
diff --git a/fan_pwm.cpp b/fan_pwm.cpp
index f0910c6..7675b10 100644
--- a/fan_pwm.cpp
+++ b/fan_pwm.cpp
@@ -6,6 +6,8 @@
 #include "sensorset.hpp"
 #include "sysfs.hpp"
 
+#include <fmt/format.h>
+
 #include <filesystem>
 #include <phosphor-logging/elog-errors.hpp>
 #include <string>
@@ -39,8 +41,7 @@
         auto file =
             sysfs::make_sysfs_path(_ioAccess->path(), _type, _id, empty);
 
-        log<level::INFO>("Logging failing sysfs file",
-                         phosphor::logging::entry("FILE=%s", file.c_str()));
+        log<level::INFO>(fmt::format("Failing sysfs file: {}", file).c_str());
 
         exit(EXIT_FAILURE);
     }
diff --git a/fan_speed.cpp b/fan_speed.cpp
index 65e5655..e990410 100644
--- a/fan_speed.cpp
+++ b/fan_speed.cpp
@@ -6,6 +6,8 @@
 #include "sensorset.hpp"
 #include "sysfs.hpp"
 
+#include <fmt/format.h>
+
 #include <phosphor-logging/elog-errors.hpp>
 #include <xyz/openbmc_project/Control/Device/error.hpp>
 
@@ -39,8 +41,8 @@
             auto file = sysfs::make_sysfs_path(_ioAccess->path(), _type, _id,
                                                entry::target);
 
-            log<level::INFO>("Logging failing sysfs file",
-                             phosphor::logging::entry("FILE=%s", file.c_str()));
+            log<level::INFO>(
+                fmt::format("Failing sysfs file: {}", file).c_str());
 
             exit(EXIT_FAILURE);
         }
@@ -75,8 +77,7 @@
                                                    _id, entry::enable);
 
             log<level::INFO>(
-                "Logging failing sysfs file",
-                phosphor::logging::entry("FILE=%s", fullPath.c_str()));
+                fmt::format("Failing sysfs file: {}", fullPath).c_str());
 
             exit(EXIT_FAILURE);
         }
diff --git a/mainloop.cpp b/mainloop.cpp
index bd334a0..7303307 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -29,6 +29,8 @@
 #include "thresholds.hpp"
 #include "util.hpp"
 
+#include <fmt/format.h>
+
 #include <cassert>
 #include <cstdlib>
 #include <functional>
@@ -238,8 +240,7 @@
             xyz::openbmc_project::Sensor::Device::ReadFailure::
                 CALLOUT_DEVICE_PATH(_devPath.c_str()));
 
-        log<level::INFO>("Logging failing sysfs file",
-                         entry("FILE=%s", file.c_str()));
+        log<level::INFO>(fmt::format("Failing sysfs file: {}", file).c_str());
         exit(EXIT_FAILURE);
     }
     auto sensorValue = valueInterface->value();
@@ -533,8 +534,8 @@
                 xyz::openbmc_project::Sensor::Device::ReadFailure::
                     CALLOUT_DEVICE_PATH(_devPath.c_str()));
 
-            log<level::INFO>("Logging failing sysfs file",
-                             entry("FILE=%s", file.c_str()));
+            log<level::INFO>(
+                fmt::format("Failing sysfs file: {}", file).c_str());
 
             exit(EXIT_FAILURE);
         }
diff --git a/meson.build b/meson.build
index 41ffb9d..66e6801 100644
--- a/meson.build
+++ b/meson.build
@@ -20,6 +20,7 @@
 sdbusplus = dependency('sdbusplus')
 sdeventplus = dependency('sdeventplus')
 stdplus = dependency('stdplus')
+fmt = dependency('fmt')
 threads = dependency('threads')
 
 conf = configuration_data()
@@ -79,6 +80,7 @@
     'mainloop.cpp',
     'sensorset.cpp',
     dependencies: [
+        fmt,
         gpioplus,
         phosphor_dbus_interfaces,
         phosphor_logging,
diff --git a/sensor.cpp b/sensor.cpp
index 145ba6c..1c91c1e 100644
--- a/sensor.cpp
+++ b/sensor.cpp
@@ -8,6 +8,8 @@
 #include "sensorset.hpp"
 #include "sysfs.hpp"
 
+#include <fmt/format.h>
+
 #include <cassert>
 #include <chrono>
 #include <cmath>
@@ -243,8 +245,7 @@
                 metadata::CALLOUT_DEVICE_PATH(_devPath.c_str()));
 
             log<level::INFO>(
-                "Logging failing sysfs file",
-                phosphor::logging::entry("FILE=%s", sysfsFullPath.c_str()));
+                fmt::format("Failing sysfs file: {}", sysfsFullPath).c_str());
         }
     }
 
diff --git a/targets.hpp b/targets.hpp
index ffdb476..c1a2feb 100644
--- a/targets.hpp
+++ b/targets.hpp
@@ -5,6 +5,8 @@
 #include "fan_speed.hpp"
 #include "hwmonio.hpp"
 
+#include <fmt/format.h>
+
 #include <filesystem>
 #include <memory>
 #include <phosphor-logging/elog-errors.hpp>
@@ -153,8 +155,8 @@
                     metadata::CALLOUT_DEVICE_PATH(devPath.c_str()));
 
                 log<level::INFO>(
-                    "Logging failing sysfs file",
-                    phosphor::logging::entry("FILE=%s", sysfsFullPath.c_str()));
+                    fmt::format("Failing sysfs file: {}", sysfsFullPath)
+                        .c_str());
             }
 
             static constexpr bool deferSignals = true;
diff --git a/test/Makefile.am b/test/Makefile.am
index 41cee60..3674dca 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -17,7 +17,8 @@
 	$(OESDK_TESTCASE_FLAGS) \
 	$(SDBUSPLUS_LIBS) \
 	$(PHOSPHOR_DBUS_INTERFACES_LIBS) \
-	$(CODE_COVERAGE_LIBS)
+	$(CODE_COVERAGE_LIBS) \
+	$(FMT_LIBS)
 
 # Run all 'check' test programs
 check_PROGRAMS = hwmon_unittest fanpwm_unittest sensor_unittest hwmonio_default_unittest env_unittest average_unittest
diff --git a/test/meson.build b/test/meson.build
index 54daaa8..cbe1f5d 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -28,6 +28,7 @@
         gmock,
         gtest,
         phosphor_logging,
+        fmt,
     ],
     include_directories: '..',
     link_with: [
@@ -41,6 +42,7 @@
     dependencies: [
         gmock,
         gtest,
+        fmt,
     ],
     include_directories: '..',
     link_with: [
@@ -54,6 +56,7 @@
     dependencies: [
         gtest,
         gmock,
+        fmt,
     ],
     include_directories: '..',
     link_with: [
@@ -68,6 +71,7 @@
     dependencies: [
         gtest,
         gmock,
+        fmt,
     ],
     include_directories: '..',
     link_with: [