设为首页 加入收藏

TOP

常用的Log日志打印与输出(三)
2015-07-24 05:54:31 来源: 作者: 【 】 浏览:8
Tags:常用 Log 日志 打印 输出
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); } }
只是进行了一个简单的封装、方便记录与管理、

首页 上一页 1 2 3 4 下一页 尾页 3/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇LeetCode:Substring with Concate.. 下一篇kd-tree讲解 & bzoj 2648 &am..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: