Add multi-host support

This refactoring includes:
- added multi-host mode support;
- added support for graceful shutdown of the service;
- added support to flush the log buffer as it fills;
- D-Bus service xyz.openbmc_project.HostLogger replaced with SIGUSR1
  signal handler;
- self diagnostic messages now registered via phosphor-logging;
- added unit tests;
- build system migrated from autotools to meson;
- source code aligned with OpenBMC conventions.

Change-Id: If6c1dfde278af685d8563450543a6587a282c7e4
Signed-off-by: Artem Senichev <a.senichev@yadro.com>
diff --git a/src/file_storage.hpp b/src/file_storage.hpp
new file mode 100644
index 0000000..0292440
--- /dev/null
+++ b/src/file_storage.hpp
@@ -0,0 +1,65 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright (C) 2020 YADRO
+
+#pragma once
+
+#include "log_buffer.hpp"
+
+#include <filesystem>
+
+/**
+ * @class FileStorage
+ * @brief Persistent file storage with automatic log file rotation.
+ */
+class FileStorage
+{
+  public:
+    /**
+     * @brief Constructor.
+     *
+     * @param[in] path absolute path to the output directory
+     * @param[in] prefix prefix used for log file names
+     * @param[in] maxFiles max number of log files that can be stored
+     *
+     * @throw std::exception in case of errors
+     */
+    FileStorage(const std::string& path, const std::string& prefix,
+                size_t maxFiles);
+
+    /**
+     * @brief Save log buffer to a file.
+     *
+     * @param[in] buf buffer with log message to save
+     *
+     * @throw std::exception in case of errors
+     *
+     * @return path to saved file
+     */
+    std::string save(const LogBuffer& buf) const;
+
+  private:
+    /**
+     * @brief Prepare output directory for a new log file and construct path.
+     *
+     * @throw std::exception in case of errors
+     *
+     * @return full path to the new file
+     */
+    std::string newFile() const;
+
+    /**
+     * @brief Rotate log files in the output directory by removing the oldest
+     *        logs.
+     *
+     * @throw std::exception in case of errors
+     */
+    void rotate() const;
+
+  private:
+    /** @brief Output directory. */
+    std::filesystem::path outDir;
+    /** @brief Prefix used for log file names. */
+    std::string filePrefix;
+    /** @brief Max number of log files that can be stored. */
+    size_t filesLimit;
+};