Home | History | Annotate | Download | only in log
      1 /*
      2  * Copyright (C) 2018 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 package com.android.car.dialer.log;
     17 
     18 import android.util.Log;
     19 
     20 /**
     21  * Util class for logging.
     22  */
     23 public class L {
     24 
     25     private String mTag;
     26 
     27     public L(String tag) {
     28         mTag = tag;
     29     }
     30 
     31     public void v(String msg) {
     32         if (Log.isLoggable(mTag, Log.VERBOSE)) {
     33             Log.v(mTag, msg);
     34         }
     35     }
     36 
     37     public void d(String msg) {
     38         if (Log.isLoggable(mTag, Log.DEBUG)) {
     39             Log.d(mTag, msg);
     40         }
     41     }
     42 
     43     public void w(String msg) {
     44         Log.w(mTag, msg);
     45     }
     46 
     47     public static L logger(String tag) {
     48         return new L(tag);
     49     }
     50 
     51     public static void v(String tag, String msg) {
     52         if (Log.isLoggable(tag, Log.VERBOSE)) {
     53             Log.v(tag, msg);
     54         }
     55     }
     56 
     57     public static void d(String tag, String msg) {
     58         if (Log.isLoggable(tag, Log.DEBUG)) {
     59             Log.d(tag, msg);
     60         }
     61     }
     62 
     63     public static void w(String tag, String msg) {
     64         Log.w(tag, msg);
     65     }
     66 
     67     public static void i(String tag, String msg) {
     68         Log.i(tag, msg);
     69     }
     70 }
     71