Add drive logging

This adds logging for drive failures and inventory
changes.

Tested:

        {
            "@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry",
            "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/1565674864_1",
            "@odata.type": "#LogEntry.v1_4_0.LogEntry",
            "Created": "2019-08-13T05:41:04+00:00",
            "EntryType": "Event",
            "Id": "1565674864_1",
            "Message": "Drive 2 with serial number N/A was installed.",
            "MessageArgs": [
                "Drive",
                "2",
                "N/A"
            ],
            "MessageId": "OpenBMC.0.1.InventoryAdded",
            "Name": "System Event Log Entry",
            "Severity": "OK"
        },
        {
            "@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry",
            "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/1565674987",
            "@odata.type": "#LogEntry.v1_4_0.LogEntry",
            "Created": "2019-08-13T05:43:07+00:00",
            "EntryType": "Event",
            "Id": "1565674987",
            "Message": "Drive Error Occurred: Drive 1.",
            "MessageArgs": [
                "Drive 1"
            ],
            "MessageId": "OpenBMC.0.1.DriveError",
            "Name": "System Event Log Entry",
            "Severity": "Warning"
        }

Change-Id: Ia23e6f48b753cbeb36c3176c39a28f687ad7061c
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/hsbp-manager/include/utils.hpp b/hsbp-manager/include/utils.hpp
index a3b0294..002b1ed 100644
--- a/hsbp-manager/include/utils.hpp
+++ b/hsbp-manager/include/utils.hpp
@@ -14,6 +14,8 @@
 // limitations under the License.
 */
 
+#include <systemd/sd-journal.h>
+
 #include <boost/algorithm/string/predicate.hpp>
 #include <boost/asio/io_context.hpp>
 #include <boost/asio/steady_timer.hpp>
@@ -184,3 +186,28 @@
         power::busname, power::path, properties::interface, properties::get,
         power::interface, power::property);
 }
+
+inline void logDeviceAdded(const std::string& model, const std::string& type,
+                           const std::string& sn)
+{
+    sd_journal_send("MESSAGE=%s", "Inventory Added", "PRIORITY=%i", LOG_ERR,
+                    "REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.InventoryAdded",
+                    "REDFISH_MESSAGE_ARGS=%s,%s,%s", model.c_str(),
+                    type.c_str(), sn.c_str(), NULL);
+}
+
+inline void logDeviceRemoved(const std::string& model, const std::string& type,
+                             const std::string& sn)
+{
+    sd_journal_send("MESSAGE=%s", "Inventory Removed", "PRIORITY=%i", LOG_ERR,
+                    "REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.InventoryRemoved",
+                    "REDFISH_MESSAGE_ARGS=%s,%s,%s", model.c_str(),
+                    type.c_str(), sn.c_str(), NULL);
+}
+
+inline void logDriveError(const std::string& name)
+{
+    sd_journal_send("MESSAGE=%s", "Drive Error", "PRIORITY=%i", LOG_ERR,
+                    "REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.DriveError",
+                    "REDFISH_MESSAGE_ARGS=%s", name.c_str(), NULL);
+}