郑州app开发一个LogUtils工具类。具体实现代码如下,经过测试,可以直接用!!!
java代码如下:
public class LogUtils {
private static int currentLev = 4;
private static int DEBUG_LEV = 4;
private static int INFO_LEV = 3;
private static int WARNING_LEV = 2;
private static int ERROR_LEV = 1;
public static void d(Class clazz,String log){
if (currentLev >= DEBUG_LEV){
Log.d(clazz.getSimpleName(),log);
}
}
public static void i(Class clazz,String log){
if (currentLev >= INFO_LEV){
Log.d(clazz.getSimpleName(),log);
}
}
public static void w(Class clazz,String log){
if (currentLev >= WARNING_LEV){
Log.d(clazz.getSimpleName(),log);
}
}
public static void e(Class clazz,String log){
if (currentLev >= ERROR_LEV){
Log.d(clazz.getSimpleName(),log);
}
}
}