android自定义LogUtil
程序员文章站
2022-06-03 10:48:59
...
开发阶段设置为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); } } }
上一篇: ThinkPHP自动验证失败的解决方法
下一篇: Vue的轮播图组件实现方法