blob: 1bef0b04207492d808108e97c5f6891e4149e36f [file] [log] [blame]
keunyoungca515072015-07-10 12:21:47 -07001/*
2 * Copyright (C) 2015 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
17package com.android.car;
18
Mayank Garg72c71d22021-02-03 23:54:45 -080019/**
20 * Helper class for class tags for CarService.
21 */
22public final class CarLog {
23 private static final String PREFIX = "CAR.";
24 // Matcher to check if class name has keyword "Car"
25 private static final String MATCHER = ".*Car([A-Z].*|$)";
Pavel Maltsev82c20cd2017-04-11 12:38:17 -070026
Keun-young Park4727da32016-05-31 10:00:51 -070027 public static final String TAG_AM = "CAR.AM";
Vitalii Tomkiv46371472016-05-23 16:55:22 -070028 public static final String TAG_APP_FOCUS = "CAR.APP_FOCUS";
keunyoung4b0212c2015-10-29 17:11:57 -070029 public static final String TAG_AUDIO = "CAR.AUDIO";
Keun young Park7af7d6c2019-09-12 10:31:48 -070030 public static final String TAG_DIAGNOSTIC = "CAR.DIAGNOSTIC";
keunyoungcc449f72015-08-12 10:46:27 -070031 public static final String TAG_HAL = "CAR.HAL";
Keun-young Park4727da32016-05-31 10:00:51 -070032 public static final String TAG_INPUT = "CAR.INPUT";
Simon Dai527eb552019-02-12 13:06:15 -080033 public static final String TAG_MEDIA = "CAR.MEDIA";
Keun-young Park4aeb4bf2015-12-08 18:31:33 -080034 public static final String TAG_PACKAGE = "CAR.PACKAGE";
keunyoung4b0212c2015-10-29 17:11:57 -070035 public static final String TAG_POWER = "CAR.POWER";
Keun-young Park4727da32016-05-31 10:00:51 -070036 public static final String TAG_PROJECTION = "CAR.PROJECTION";
keunyoung4b0212c2015-10-29 17:11:57 -070037 public static final String TAG_SENSOR = "CAR.SENSOR";
38 public static final String TAG_SERVICE = "CAR.SERVICE";
Keun young Park7af7d6c2019-09-12 10:31:48 -070039 public static final String TAG_STORAGE = "CAR.STORAGE";
Keun young Park7af7d6c2019-09-12 10:31:48 -070040 public static final String TAG_USER = "CAR.USER";
Eric Jeongae2c04c2020-02-21 09:18:31 -080041 public static final String TAG_WATCHDOG = "CAR.WATCHDOG";
Pavel Maltsev82c20cd2017-04-11 12:38:17 -070042
Mayank Garg72c71d22021-02-03 23:54:45 -080043 /**
44 * Returns TAG that should be used for logging.
45 */
46 public static String tagFor(Class<?> clazz) {
47 String tag = clazz.getSimpleName();
48 // If class has a matcher, don't add prefix.
49 if (tag.matches(MATCHER)) return tag;
50 return PREFIX + tag;
Pavel Maltsev82c20cd2017-04-11 12:38:17 -070051 }
keunyoungca515072015-07-10 12:21:47 -070052}