1/*
2 * Copyright (C) 2017 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
17syntax = "proto2";
18package android.util;
19
20import "frameworks/base/core/proto/android/privacy.proto";
21
22option java_multiple_files = true;
23
24// Represents a Text Log in logd
25// Next Tag: 9
26message TextLogEntry {
27    option (android.msg_privacy).dest = DEST_EXPLICIT;
28
29    optional uint64 sec = 1;
30    optional uint64 nanosec = 2;
31
32    enum LogPriority {
33        LOG_UNKNOWN = 0;
34        LOG_DEFAULT = 1;
35        LOG_VERBOSE = 2;
36        LOG_DEBUG   = 3;
37        LOG_INFO    = 4;
38        LOG_WARN    = 5;
39        LOG_ERROR   = 6;
40        LOG_FATAL   = 7;
41        LOG_SILENT  = 8;
42    }
43    optional LogPriority priority = 3;
44    optional int32 uid = 4;
45    optional int32 pid = 5;
46    optional int32 tid = 6;
47    optional string tag = 7;
48    optional string log = 8;
49}
50
51// Represents a Binary Log in logd, need to look event-log-tags for more info.
52// Next Tag: 8
53message BinaryLogEntry {
54    option (android.msg_privacy).dest = DEST_EXPLICIT;
55
56    optional uint64 sec = 1;
57    optional uint64 nanosec = 2;
58    optional int32 uid = 3;
59    optional int32 pid = 4;
60    optional int32 tid = 5;
61
62    // Index of the event tag, can look up in event-log-tags file
63    optional uint32 tag_index = 6;
64
65    message Elem {
66        // must be sync with AOSP liblog's log.h
67        enum Type {
68            EVENT_TYPE_LIST_STOP = 10; // ascii decimal value of char '\n'
69            EVENT_TYPE_UNKNOWN = 63; // ascii decimal value of char '?'
70
71            EVENT_TYPE_INT = 0;
72            EVENT_TYPE_LONG = 1;
73            EVENT_TYPE_STRING = 2;
74            EVENT_TYPE_LIST = 3;
75            EVENT_TYPE_FLOAT = 4;
76        }
77        optional Type type = 1 [default=EVENT_TYPE_UNKNOWN];
78
79        oneof value {
80            int32 val_int32 = 2;
81            int64 val_int64 = 3;
82            string val_string = 4;
83            float val_float = 5;
84        }
85    }
86    repeated Elem elems = 7;
87}
88
89message LogProto {
90    option (android.msg_privacy).dest = DEST_EXPLICIT;
91
92    repeated TextLogEntry text_logs = 1;
93
94    repeated BinaryLogEntry binary_logs = 2;
95}
96
97