blob: 3cec3bbcf0344055f2d64cf3f74e81b533e9de3b [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
bkchoi51076532021-06-14 14:35:01 -070019import static com.android.car.internal.ExcludeFromCodeCoverageGeneratedReport.BOILERPLATE_CODE;
20
21import com.android.car.internal.ExcludeFromCodeCoverageGeneratedReport;
22
Mayank Garg72c71d22021-02-03 23:54:45 -080023/**
24 * Helper class for class tags for CarService.
25 */
26public final class CarLog {
27 private static final String PREFIX = "CAR.";
28 // Matcher to check if class name has keyword "Car"
29 private static final String MATCHER = ".*Car([A-Z].*|$)";
Pavel Maltsev82c20cd2017-04-11 12:38:17 -070030
Keun-young Park4727da32016-05-31 10:00:51 -070031 public static final String TAG_AM = "CAR.AM";
Vitalii Tomkiv46371472016-05-23 16:55:22 -070032 public static final String TAG_APP_FOCUS = "CAR.APP_FOCUS";
keunyoung4b0212c2015-10-29 17:11:57 -070033 public static final String TAG_AUDIO = "CAR.AUDIO";
Yuncheol Heo7ac86e82020-12-02 09:12:35 -080034 public static final String TAG_CLUSTER = "CAR.CLUSTER";
Keun young Park7af7d6c2019-09-12 10:31:48 -070035 public static final String TAG_DIAGNOSTIC = "CAR.DIAGNOSTIC";
Changyeon Joc882f7a2021-03-09 08:41:41 -080036 public static final String TAG_EVS = "CAR.EVS";
keunyoungcc449f72015-08-12 10:46:27 -070037 public static final String TAG_HAL = "CAR.HAL";
Keun-young Park4727da32016-05-31 10:00:51 -070038 public static final String TAG_INPUT = "CAR.INPUT";
Simon Dai527eb552019-02-12 13:06:15 -080039 public static final String TAG_MEDIA = "CAR.MEDIA";
keunyoung4b0212c2015-10-29 17:11:57 -070040 public static final String TAG_POWER = "CAR.POWER";
Keun-young Park4727da32016-05-31 10:00:51 -070041 public static final String TAG_PROJECTION = "CAR.PROJECTION";
keunyoung4b0212c2015-10-29 17:11:57 -070042 public static final String TAG_SENSOR = "CAR.SENSOR";
43 public static final String TAG_SERVICE = "CAR.SERVICE";
Keun young Park7af7d6c2019-09-12 10:31:48 -070044 public static final String TAG_STORAGE = "CAR.STORAGE";
Zhomart Mukhamejanov44570cb2021-06-07 10:23:13 -070045 public static final String TAG_TELEMETRY = "CAR.TELEMETRY";
Ashutosh Agarwal97433352021-10-04 18:14:58 +000046 public static final String TAG_TIME = "CAR.TIME";
Eric Jeongae2c04c2020-02-21 09:18:31 -080047 public static final String TAG_WATCHDOG = "CAR.WATCHDOG";
Pavel Maltsev82c20cd2017-04-11 12:38:17 -070048
Mayank Garg72c71d22021-02-03 23:54:45 -080049 /**
50 * Returns TAG that should be used for logging.
51 */
52 public static String tagFor(Class<?> clazz) {
53 String tag = clazz.getSimpleName();
54 // If class has a matcher, don't add prefix.
55 if (tag.matches(MATCHER)) return tag;
56 return PREFIX + tag;
Pavel Maltsev82c20cd2017-04-11 12:38:17 -070057 }
bkchoi51076532021-06-14 14:35:01 -070058
59 @ExcludeFromCodeCoverageGeneratedReport(reason = BOILERPLATE_CODE,
60 details = "private constructor")
61 private CarLog() {
62 throw new UnsupportedOperationException("contains only static methods");
63 }
keunyoungca515072015-07-10 12:21:47 -070064}