该工具类能打印当前调用的类名、方法名以及行数,并能在log中点击类名定位到调用行数
package com.tama.util;
import android.util.Log;
public class LogUtil {
//当前使用log的类名
private static String className;
//当前使用log的方法名
private static String methodName;
//当前使用log的行数
private static int lineNumber;
//log的开关,在Application中设置,上线关闭,测试打开
private static boolean debuggable = false;
private LogUtil() {
}
public static void setDebuggable(boolean debuggable) {
LogUtil.debuggable = debuggable;
}
private static boolean isDebuggable() {
return debuggable;
}
//设置显示的log信息
private static String createLog(String log) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("====================")
.append(methodName)
.append("(")
.append(classNa