logd: remove SocketClient from LogBuffer and LogBufferElement
In the future, we'll want to be able to write to outputs that are not
necessarily a libsysutils SocketClient, for example host tests of
LogBuffer. Therefore, we add a LogWriter class to be used instead of
SocketClient.
Test: logging unit tests
Change-Id: I4385be65e14e83a635691a7ba79e9bf060e49484
diff --git a/logd/LogBuffer.h b/logd/LogBuffer.h
index 887e5f0..6274051 100644
--- a/logd/LogBuffer.h
+++ b/logd/LogBuffer.h
@@ -25,6 +25,8 @@
#include "LogBufferElement.h"
+class LogWriter;
+
enum class FlushToResult {
kSkip,
kStop,
@@ -42,10 +44,10 @@
// lastTid is an optional context to help detect if the last previous
// valid message was from the same source so we can differentiate chatty
// filter types (identical or expired)
+ static const uint64_t FLUSH_ERROR = 0;
virtual uint64_t FlushTo(
- SocketClient* writer, uint64_t start,
+ LogWriter* writer, uint64_t start,
pid_t* last_tid, // nullable
- bool privileged, bool security,
const std::function<FlushToResult(const LogBufferElement* element)>& filter) = 0;
virtual bool Clear(log_id_t id, uid_t uid) = 0;