blob: 49a0aba373b8fb0b6d747118613d48638bc7ea05 [file] [log] [blame]
Tom Cherryec39a3f2020-07-09 09:51:16 -07001/*
2 * Copyright (C) 2020 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#pragma once
18
19#include "SimpleLogBuffer.h"
20
21#include <string>
22#include <tuple>
23#include <vector>
24
25#include <android-base/unique_fd.h>
26
27#include "RecordedLogMessage.h"
28
29class RecordingLogBuffer : public SimpleLogBuffer {
30 public:
31 RecordingLogBuffer(LogReaderList* reader_list, LogTags* tags, LogStatistics* stats)
32 : SimpleLogBuffer(reader_list, tags, stats) {}
33
34 int Log(log_id_t log_id, log_time realtime, uid_t uid, pid_t pid, pid_t tid, const char* msg,
35 uint16_t len) override;
36
37 private:
38 void RecordLogMessage(log_id_t log_id, log_time realtime, uid_t uid, pid_t pid, pid_t tid,
39 const char* msg, uint16_t len);
40
41 std::vector<std::pair<RecordedLogMessage, std::string>> since_boot_messages_;
42 android::base::unique_fd fd_;
43};