android自定义LogUtil
程序员文章站
2022-06-03 10:43:09
...
开发阶段设置为VERBOSE ,正式上线就设置为NOTHING
调用方式:LogUtil.d("TAG","debug log");
public class LogUtil { public static final int VERBOSE = 1; public static final int DEBUG = 2; public static final int INFO = 3; public static final int WARN = 4; public static final int ERROR = 5; public static final int NOTHING = 6; public static int level = VERBOSE; public static void v(String tag, String msg) { if (level <= VERBOSE) { Log.v(tag, msg); } } public static void d(String tag, String msg) { if (level <= DEBUG) { Log.v(tag, msg); } } public static void i(String tag, String msg) { if (level <= INFO) { Log.v(tag, msg); } } public static void w(String tag, String msg) { if (level <= WARN) { Log.v(tag, msg); } } public static void e(String tag, String msg) { if (level <= ERROR) { Log.v(tag, msg); } } }
推荐阅读
-
Android studio中IDE窗口怎么显示或者隐藏?
-
Android studio怎么使用git获取最新内容然后合并?
-
Android Caused by: java.lang.ClassNotFoundException解决办法
-
Android开发之菜单(menu)用法实例分析
-
Android自定义ScrollView实现放大回弹效果实例代码
-
Android编程之ActionBar Tabs用法实例分析
-
Android自定义View圆形进度条控件(三)
-
Android studio中logcat提示信息设置?
-
Android获取本地相册图片和拍照获取图片的实现方法
-
Android studio怎么设置文件结构弹窗?