1.为了方便的使用Log打印日志,以及后续方便撤销日志打印,所以对Log类进行封装是一件好事。
package market.phone; import android.util.Log; /**
* 自己封装的log类,按是调试或者是实际
* Created by Administrator on 2017/6/13.
*/ public class LogU {
/*m默认不打印Log,如果要打印,置为true*/
private static boolean enableLog = false; public static void Le(String tag,String msg){
if(enableLog)
Log.e(tag,msg); }
public static void Ld(String tag,String msg){
if(enableLog)
Log.d(tag,msg); } public static void Li(String tag,String msg){
if(enableLog)
Log.i(tag,msg); }
public static void Lv(String tag,String msg){
if(enableLog)
Log.v(tag,msg); }
public static void Lw(String tag,String msg){
if(enableLog)
Log.w(tag,msg); } }
2.通过修改enableLog的值来实现我们的打印Log需求