summaryrefslogtreecommitdiffstats
path: root/logd/LogBuffer.h
diff options
context:
space:
mode:
authorChenjie Luo <cjluo@google.com>2017-04-27 16:49:09 -0700
committerChenjie Luo <cjluo@google.com>2017-04-28 17:30:25 -0700
commitfafea32468e0d59c1ce2eb845dd07a0b4e746cf0 (patch)
tree61797e8d7955cb3f00172e5968c191901a36643c /logd/LogBuffer.h
parent483d2f9a59bf4a5130e0a79306f30c25f675812c (diff)
downloadsystem_core-fafea32468e0d59c1ce2eb845dd07a0b4e746cf0.tar.gz
system_core-fafea32468e0d59c1ce2eb845dd07a0b4e746cf0.tar.bz2
system_core-fafea32468e0d59c1ce2eb845dd07a0b4e746cf0.zip
Modularize logd.
Separates logd body into a static library liblogd and virtualize LogBuffer::log to be in a new interface class LogBufferInterface. User could have different implementation. Bug: 37756450 Test: liblog-unit-tests, logd-unit-tests and logcat-unit-tests with (b/37791296). Change-Id: I1504ff0e992744001b5a2e9abd45692d1318a152
Diffstat (limited to 'logd/LogBuffer.h')
-rw-r--r--logd/LogBuffer.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/logd/LogBuffer.h b/logd/LogBuffer.h
index 51edd8628..e59775488 100644
--- a/logd/LogBuffer.h
+++ b/logd/LogBuffer.h
@@ -27,6 +27,7 @@
#include <sysutils/SocketClient.h>
#include "LogBufferElement.h"
+#include "LogBufferInterface.h"
#include "LogStatistics.h"
#include "LogTags.h"
#include "LogTimes.h"
@@ -74,7 +75,7 @@ static bool isMonotonic(const log_time& mono) {
typedef std::list<LogBufferElement*> LogBufferElementCollection;
-class LogBuffer {
+class LogBuffer : public LogBufferInterface {
LogBufferElementCollection mLogElements;
pthread_rwlock_t mLogElementsLock;
@@ -107,14 +108,14 @@ class LogBuffer {
LastLogTimes& mTimes;
explicit LogBuffer(LastLogTimes* times);
- ~LogBuffer();
+ ~LogBuffer() override;
void init();
bool isMonotonic() {
return monotonic;
}
int log(log_id_t log_id, log_time realtime, uid_t uid, pid_t pid, pid_t tid,
- const char* msg, unsigned short len);
+ const char* msg, unsigned short len) override;
// 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)