标签:
//log管理类,开发阶段 level设为verbose,记录全部数据。
//上线后,将level设置为nothing,屏蔽全部数据
//app维修,将level再次设置为level,便于维修
public class LogUtils {
public final static 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 final int level = verbose;
public static void verbose(String tag, String msg) {
if (level<=verbose) {
Log.v(tag, msg);
}
}
public static void debug(String tag, String msg) {
if (level<=debug) {
Log.d(tag, msg);
}
}
public static void info(String tag, String msg) {
if (level<=info) {
Log.i(tag, msg);
}
}
public static void warn(String tag, String msg) {
if (level<= warn) {
Log.w(tag, msg);
}
}
public static void error(String tag, String msg) {
if (level<=error) {
Log.e(tag, msg);
}
}
}
使用方式:
直接使用该类中的方法
LogUtils.i("tag","记录的数据");
标签:
原文地址:http://my.oschina.net/u/2406195/blog/482458