Enhance fan tracing support - add device access info

Move file names for file errors to the journal message. Enhance
usablility.

Logging messages for file errors contain the file names and other
information inside structured entries rather than directly in the log
message.  This makes viewing errors more difficult than need be.  Before
this change, the journal report needed to be run with '-o verbose' to
see the file names.

Tested:
- For cooling-type/cooling_type.cpp
  Approx line 39:
    A dry-dock test of this message was performed by commenting out the
    return for the successful case just above and adding a successful
    return just below the journal message.
    Then the next test can output this log message:
    Failed to get libevdev from file descriptor 4, return code 0

  Approx line 71:
  Do this to get error below:
   "phosphor-cooling-type --air
   --dev=/dev/input/by-path/platform-gpio-keys-polled-event
   --path=/system/chassis/motherboard/ --event=21"
   Message:
    "Device does not support event type keycode 21"

- For cooling-type/main.cpp
   Approx line 73:
   Do this to provoke error below:
    "phosphor-cooling-type --air
     --dev=/dev/input/by-path/platform-gpio-keys-polled-event
      --path=/system/chassis/motherboard/ --event=6"
  Message:
    "Uncaught DBus method failure exception Busname:
      xyz.openbmc_project.Inventory.Manager Path:
      /xyz/openbmc_project/inventory Interface
      xyz.openbmc_project.Inventory.Manager Method: Notify"

 - For presence/fallback.cpp
   Approx line 56:
   Run fan presence application using a 'fallback' rpolicy
   for a fan and set that fan's gpio presence line to false within
   simulation.

   Journal Message:
 Using backup presence sensor for fan /system/chassis/motherboard/fan0

For presence/fallback.cpp
Approx line 82:
   Set a fan's gpio presence line to false within simulation and then run
   the fan presence application using a 'fallback' rpolicy for that fan.

Journal Message:
 Using backup presence sensor for fan /system/chassis/motherboard/fan0

- For presence/tach.cpp
   Approx line 76:
   Remove a fan sensor from the fan controller hwmon config that is
   configured within the fan presence application. Then unbind and
   rebind the fan controller device driver and start the fan presence
   application.

Journal Message:
   Unable to read fan tach sensor /xyz/openbmc_project/sensors/fan_tach/fan3_0

- For utility.hpp:
   Approx line 65:
    Do this to get error below:
     "phosphor-cooling-type --air
      --dev=/dev/input/by-path/platform-gpio-keys-polled-
      --path=/system/chassis/motherboard/ --event=21"
   Message:
     "Failed to open file device path
      /dev/input/by-path/platform-gpio-keys-polled-"

Signed-off-by: Jay Meyer <jaymeyer@us.ibm.com>
Change-Id: I592481d92b18b85e5ea5b7040389467530b581e1
diff --git a/presence/fallback.cpp b/presence/fallback.cpp
index 726c988..4a025a7 100644
--- a/presence/fallback.cpp
+++ b/presence/fallback.cpp
@@ -18,6 +18,8 @@
 #include "fan.hpp"
 #include "psensor.hpp"
 
+#include <fmt/format.h>
+
 #include <phosphor-logging/log.hpp>
 
 #include <algorithm>
@@ -52,8 +54,9 @@
                 ++activeSensor;
             }
             phosphor::logging::log<phosphor::logging::level::INFO>(
-                "Using backup presence sensor.",
-                phosphor::logging::entry("FAN=%s", std::get<1>(fan).c_str()));
+                fmt::format("Using backup presence sensor for fan {}",
+                            std::get<1>(fan))
+                    .c_str());
             activeSensor = it;
         }
     }
@@ -77,8 +80,9 @@
     if (activeSensor != sensors.begin())
     {
         phosphor::logging::log<phosphor::logging::level::INFO>(
-            "Using backup presence sensor.",
-            phosphor::logging::entry("FAN=%s", std::get<1>(fan).c_str()));
+            fmt::format("Using backup presence sensor for fan {}",
+                        std::get<1>(fan))
+                .c_str());
     }
 
     // Callout the broken sensors.
diff --git a/presence/tach.cpp b/presence/tach.cpp
index 6cddc23..9d6c0e3 100644
--- a/presence/tach.cpp
+++ b/presence/tach.cpp
@@ -17,6 +17,8 @@
 
 #include "rpolicy.hpp"
 
+#include <fmt/format.h>
+
 #include <phosphor-logging/log.hpp>
 
 #include <string>
@@ -71,8 +73,9 @@
             // Assume not spinning.
 
             std::get<double>(s) = 0;
-            log<level::INFO>("Unable to read fan tach sensor.",
-                             entry("SENSOR=%s", tachPath.c_str()));
+            log<level::INFO>(
+                fmt::format("Unable to read fan tach sensor {}", tachPath)
+                    .c_str());
         }
     }