Use sdeventplus

Start using the sdeventplus event mechanisms so that future code
can take advantage of it for things like timers and other events.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I6ffe80266257bfd3512a5b848c47f5ccfb5206e8
diff --git a/Makefile.am b/Makefile.am
index e1ec5c3..81745a0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -70,10 +70,12 @@
 		$(SYSTEMD_LIBS) \
 		$(SDBUSPLUS_LIBS) \
 		$(PHOSPHOR_DBUS_INTERFACES_LIBS) \
+		$(SDEVENTPLUS_LIBS) \
 		-lstdc++fs
 phosphor_log_manager_CXXFLAGS = \
 		$(SYSTEMD_CFLAGS) \
 		$(SDBUSPLUS_CFLAGS) \
+		$(SDEVENTPLUS_CFLAGS) \
 		$(PHOSPHOR_DBUS_INTERFACES_CFLAGS)
 
 
diff --git a/configure.ac b/configure.ac
index 3139382..27175a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,6 +38,7 @@
     # If we ever have a library, move this to private.
     AX_PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus])
     AX_PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces])
+    PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus])
 
     # Check for sdbus++
     AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
diff --git a/log_manager.hpp b/log_manager.hpp
index 4b09952..baf6812 100644
--- a/log_manager.hpp
+++ b/log_manager.hpp
@@ -119,6 +119,11 @@
      */
     int getInfoErrSize();
 
+    sdbusplus::bus::bus& getBus()
+    {
+        return busLog;
+    }
+
   private:
     /*
      * @fn _commit()
diff --git a/log_manager_main.cpp b/log_manager_main.cpp
index ddcb063..42eb982 100644
--- a/log_manager_main.cpp
+++ b/log_manager_main.cpp
@@ -6,10 +6,13 @@
 #include <experimental/filesystem>
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/server/manager.hpp>
+#include <sdeventplus/event.hpp>
 
 int main(int argc, char* argv[])
 {
     auto bus = sdbusplus::bus::new_default();
+    auto event = sdeventplus::Event::get_default();
+    bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
 
     // Add sdbusplus ObjectManager for the 'root' path of the logging manager.
     sdbusplus::server::manager::manager objManager(bus, OBJ_LOGGING);
@@ -40,11 +43,5 @@
         }
     }
 
-    while (true)
-    {
-        bus.process_discard();
-        bus.wait();
-    }
-
-    return 0;
+    return event.loop();
 }