常用的Log日志打印与输出(三)

2015-07-24 05:54:31 · 作者: · 浏览: 19
Name()) .append(COLON) .append(msg) .toString()); } //-----------------------------------Log.wtf /** * Log.wtf * @param e */ public static void wtf(Throwable e) { if (isShowLog) wtf(TAG,e); } public static void wtf(String tag,Throwable e) { if (isShowLog) Log.wtf(tag, new StringBuilder() .append(e.getStackTrace()[0].getLineNumber()) .append(COLON) .append(e.getStackTrace()[0].getClassName()) .append(ARROW) .append(e.getStackTrace()[0].getMethodName()) .append(COLON) .append(e.getMessage()) .toString()); } public static void wtf(Throwable e,String msg) { if (isShowLog) wtf(TAG,e,msg); } public static void wtf(String tag,Throwable e,String msg) { if (isShowLog) Log.wtf(tag, new StringBuilder() .append(e.getStackTrace()[0].getLineNumber()) .append(COLON) .append(e.getStackTrace()[0].getClassName()) .append(ARROW) .append(e.getStackTrace()[0].getMethodName()) .append(COLON) .append(msg) .toString()); } public static void wtf(String msg) { if (isShowLog) wtf(TAG, msg); } public static void wtf(String tag, String msg) { if (isShowLog) Log.wtf(tag, msg); } public static void wtf(Class cls, String msg) { if (isShowLog) wtf(TAG,cls,msg); } public static void wtf(String tag,Class
cls,String msg) { if (isShowLog) Log.wtf(tag, new StringBuilder() .append(cls.getSimpleName()) .append(COLON) .append(msg) .toString()); } public static void wtf(Class cls, String line, String msg) { if (isShowLog) e(TAG,cls,line,msg); } public static void wtf(String tag,Class cls, String line, String msg) { if (isShowLog) Log.wtf(tag, new StringBuilder() .append(line).append(COLON) .append(cls.getSimpleName()) .append(COLON) .append(msg) .toString()); } //-----------------------------------System.out.print /** * System.out.print * @param msg */ public static void print(String msg){ if(isShowLog) System.out.print(msg); } public static void print(Object obj){ if(isShowLog) System.out.print(obj); } //-----------------------------------System.out.printf /** * System.out.printf * @param msg */ public static void printf(String msg){ if(isShowLog) System.out.printf(msg); } //-----------------------------------System.out.println /** * System.out.println * @param msg */ public static void println(String msg){ if(isShowLog) System.out.println(msg); } public static void println(Object obj){ if(isShowLog) System.out.println(obj); } }
只是进行了一个简单的封装、方便记录与管理、