平时测试环境需要看log,而生产环境是不允许有log的,所以写了个工具类
public class MyLogUtil {
public static boolean openDebug =true;
private static final String TAG = "MyLogUtil";
public static void d (String msg){
if (openDebug){
Log.d(TAG,msg);
}
}
public static void e (String msg){
if (openDebug){
Log.e(TAG,msg);
}
}
public static void e(String tag,String msg){
if (openDebug){
Log.e(tag,msg);
}
}
public static void i (String msg){
if (openDebug){
Log.i(TAG,msg);
}
}
public static void i (String tag,String msg){
if (openDebug){
Log.i(tag,msg);
}
}
public static void w (String msg){
if (openDebug){
Log.w(TAG,msg);
}
}
public static void w (String tag,String msg){
if (openDebug){
Log.w(tag,msg);
}
}
}
//使用 :开关 ,openDebug为true开启 , false 关闭
//MylogUtil.d("打印")