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/config.hpp b/src/config.hpp
index a2aa614..1a213b4 100644
--- a/src/config.hpp
+++ b/src/config.hpp
@@ -5,6 +5,12 @@
 
 #include <cstddef>
 
+enum class Mode
+{
+    bufferMode,
+    streamMode
+};
+
 /**
  * @struct Config
  * @brief Configuration of the service, initialized with default values.
@@ -18,8 +24,13 @@
      */
     Config();
 
+    /** The following configs are for both modes. */
     /** @brief Socket ID used for connection with host console. */
     const char* socketId = "";
+    /** @brief The mode the service is in. */
+    Mode mode = Mode::bufferMode;
+
+    /** The following configs are for buffer mode. */
     /** @brief Max number of messages stored inside intermediate buffer. */
     size_t bufMaxSize = 3000;
     /** @brief Max age of messages (in minutes) inside intermediate buffer. */
@@ -32,4 +43,8 @@
     const char* outDir = "/var/lib/obmc/hostlogs";
     /** @brief Max number of log files in the output directory. */
     size_t maxFiles = 10;
+
+    /** The following configs are for stream mode. */
+    /** @brief Path to the unix socket that receives the log stream. */
+    const char* streamDestination = "/run/rsyslog/console_input";
 };