1 /* 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 package com.android.internal.protolog.common; 18 19 /** 20 * Defines a log group configuration object for ProtoLog. Should be implemented as en enum. 21 */ 22 public interface IProtoLogGroup { 23 /** 24 * if false all log statements for this group are excluded from compilation, 25 */ isEnabled()26 boolean isEnabled(); 27 28 /** 29 * is binary logging enabled for the group. 30 */ isLogToProto()31 boolean isLogToProto(); 32 33 /** 34 * is text logging enabled for the group. 35 */ isLogToLogcat()36 boolean isLogToLogcat(); 37 38 /** 39 * returns true is any logging is enabled for this group. 40 */ isLogToAny()41 default boolean isLogToAny() { 42 return isLogToLogcat() || isLogToProto(); 43 } 44 45 /** 46 * returns the name of the source of the logged message 47 */ getTag()48 String getTag(); 49 50 /** 51 * set binary logging for this group. 52 */ setLogToProto(boolean logToProto)53 void setLogToProto(boolean logToProto); 54 55 /** 56 * set text logging for this group. 57 */ setLogToLogcat(boolean logToLogcat)58 void setLogToLogcat(boolean logToLogcat); 59 60 /** 61 * returns name of the logging group. 62 */ name()63 String name(); 64 } 65