diff options
author | Chenjie Luo | 2017-04-27 18:49:09 -0500 |
---|---|---|
committer | Chenjie Luo | 2017-04-28 19:30:25 -0500 |
commit | fafea32468e0d59c1ce2eb845dd07a0b4e746cf0 (patch) | |
tree | 61797e8d7955cb3f00172e5968c191901a36643c /logd/LogBufferInterface.h | |
parent | 483d2f9a59bf4a5130e0a79306f30c25f675812c (diff) | |
download | platform-system-core-fafea32468e0d59c1ce2eb845dd07a0b4e746cf0.tar.gz platform-system-core-fafea32468e0d59c1ce2eb845dd07a0b4e746cf0.tar.xz platform-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/LogBufferInterface.h')
-rw-r--r-- | logd/LogBufferInterface.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/logd/LogBufferInterface.h b/logd/LogBufferInterface.h new file mode 100644 index 000000000..7d82b91f3 --- /dev/null +++ b/logd/LogBufferInterface.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012-2014 The Android Open Source Project | ||
3 | * | ||
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | * you may not use this file except in compliance with the License. | ||
6 | * You may obtain a copy of the License at | ||
7 | * | ||
8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | * | ||
10 | * Unless required by applicable law or agreed to in writing, software | ||
11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | * See the License for the specific language governing permissions and | ||
14 | * limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _LOGD_LOG_BUFFER_INTERFACE_H__ | ||
18 | #define _LOGD_LOG_BUFFER_INTERFACE_H__ | ||
19 | |||
20 | #include <sys/types.h> | ||
21 | |||
22 | #include <android-base/macros.h> | ||
23 | #include <log/log_id.h> | ||
24 | #include <log/log_time.h> | ||
25 | |||
26 | // Abstract interface that handles log when log available. | ||
27 | class LogBufferInterface { | ||
28 | public: | ||
29 | LogBufferInterface(); | ||
30 | virtual ~LogBufferInterface(); | ||
31 | // Handles a log entry when available in LogListener. | ||
32 | // Returns the size of the handled log message. | ||
33 | virtual int log(log_id_t log_id, log_time realtime, uid_t uid, pid_t pid, | ||
34 | pid_t tid, const char* msg, unsigned short len) = 0; | ||
35 | |||
36 | private: | ||
37 | DISALLOW_COPY_AND_ASSIGN(LogBufferInterface); | ||
38 | }; | ||
39 | |||
40 | #endif // _LOGD_LOG_BUFFER_INTERFACE_H__ | ||