Add the stream mode

The stream mode behaves differently in versus the existing buffer mode.

1. It leverages rsyslog to persist logs;
2. It leverages logrotate to rotate and compress logs;
3. It persists logs as soon as they are collected.

Add configuration options to choose modes at start up time. When stream
mode is disabled, no difference compared to the existing service.

See README.md for details.

This change also adds mock classes for unit test purpose.

Change-Id: Ic7d02e826c7d9372621c096c6e768e6216974150
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
diff --git a/src/service.hpp b/src/service.hpp
index 86c02c7..219260c 100644
--- a/src/service.hpp
+++ b/src/service.hpp
@@ -3,55 +3,17 @@
 
 #pragma once
 
-#include "config.hpp"
-#include "dbus_loop.hpp"
-#include "file_storage.hpp"
-#include "host_console.hpp"
-#include "log_buffer.hpp"
-
 /**
  * @class Service
- * @brief Log service: watches for events and handles them.
+ * @brief The log service interface
  */
 class Service
 {
   public:
-    /**
-     * @brief Constructor.
-     *
-     * @param[in] config service configuration
-     *
-     * @throw std::exception in case of errors
-     */
-    Service(const Config& config);
+    virtual ~Service() = default;
 
     /**
      * @brief Run the service.
-     *
-     * @throw std::exception in case of errors
      */
-    void run();
-
-  private:
-    /**
-     * @brief Flush log buffer to a file.
-     */
-    void flush();
-
-    /**
-     * @brief Read data from host console and put it into the log buffer.
-     */
-    void readConsole();
-
-  private:
-    /** @brief Service configuration. */
-    const Config& config;
-    /** @brief D-Bus event loop. */
-    DbusLoop dbusLoop;
-    /** @brief Host console connection. */
-    HostConsole hostConsole;
-    /** @brief Intermediate storage: container for parsed log messages. */
-    LogBuffer logBuffer;
-    /** @brief Persistent storage. */
-    FileStorage fileStorage;
+    virtual void run() = 0;
 };