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/test/dbus_loop_mock.hpp b/test/dbus_loop_mock.hpp
new file mode 100644
index 0000000..c8183fa
--- /dev/null
+++ b/test/dbus_loop_mock.hpp
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright (C) 2021 GOOGLE
+
+#pragma once
+
+#include "dbus_loop.hpp"
+
+#include <gmock/gmock.h>
+
+class DbusLoopMock : public DbusLoop
+{
+ public:
+ MOCK_METHOD(int, run, (), (const, override));
+ MOCK_METHOD(void, addIoHandler, (int fd, std::function<void()> callback),
+ (override));
+ MOCK_METHOD(void, addSignalHandler,
+ (int signal, std::function<void()> callback), (override));
+ MOCK_METHOD(void, addPropertyHandler,
+ (const std::string& objPath, const WatchProperties& props,
+ std::function<void()> callback),
+ (override));
+};