LogUtils工具栏

来源:互联网 发布:淘宝花呗还钱 编辑:程序博客网 时间:2024/05/21 20:30
public class LogUtils{private LogUtils(){/* cannot be instantiated */throw new UnsupportedOperationException("cannot be instantiated");}public static boolean isDebug = true;// 是否需要打印bug,可以在application的onCreate函数里面初始化private static final String TAG = "way";private mCurrentLevel = 1;private static final int VERBOSE = 1;    public static final int DEBUG = 2;    public static final int INFO = 3;        public static final int ERROR = 4;// 下面四个是默认tag的函数public static void v(String msg){if (isDebug&&mCurrentLevel<=VERBOSE)Log.v(TAG, msg);}public static void d(String msg){if (isDebug&&mCurrentLevel<=DEBUG)Log.d(TAG, msg);}public static void i(String msg){if (isDebug&&mCurrentLevel<=INFO)Log.i(TAG, msg);}public static void e(String msg){if (isDebug$$mCurrentLevel<=ERROR)Log.e(TAG, msg);}// 下面是传入自定义tag的函数public static void i(String tag, String msg){if (isDebug)Log.i(tag, msg);}public static void d(String tag, String msg){if (isDebug)Log.i(tag, msg);}public static void e(String tag, String msg){if (isDebug)Log.i(tag, msg);}public static void v(String tag, String msg){if (isDebug)Log.i(tag, msg);}}

0 0
原创粉丝点击