androidLOG打印-创新互联

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:国际域名空间、虚拟主机、营销软件、网站建设、安远网站维护、网站推广。>package com.example.testlog; import android.util.Log; public class LOG { private static final String TAG = "++++"; private static final boolean ISDEBUG = true; public static void e(String content) { if (ISDEBUG) { StackTraceElement stack= (new Throwable()).getStackTrace()[1]; String className= stack.getClassName(); int i = className.lastIndexOf(".") + 1; StringBuilder sb= new StringBuilder("[") .append(className.substring(i, className.length())) .append(".").append(stack.getMethodName()).append(" line:") .append(stack.getLineNumber()).append("]"); sb.append(" >>").append(content); Log.e(TAG, sb.toString()); } } public static void d(String content) { if (ISDEBUG) { StackTraceElement stack= (new Throwable()).getStackTrace()[1]; String className= stack.getClassName(); int i = className.lastIndexOf(".") + 1; StringBuilder sb= new StringBuilder("[") .append(className.substring(i, className.length())) .append(".").append(stack.getMethodName()).append(" line:") .append(stack.getLineNumber()).append("]"); sb.append(" >>").append(content); Log.d(TAG, sb.toString()); } } public static void v(String content) { if (ISDEBUG) { StackTraceElement stack= (new Throwable()).getStackTrace()[1]; String className= stack.getClassName(); int i = className.lastIndexOf(".") + 1; StringBuilder sb= new StringBuilder("[") .append(className.substring(i, className.length())) .append(".").append(stack.getMethodName()).append(" line:") .append(stack.getLineNumber()).append("]"); sb.append(" >>").append(content); Log.v(TAG, sb.toString()); } } public static void w(String content) { if (ISDEBUG) { StackTraceElement stack= (new Throwable()).getStackTrace()[1]; String className= stack.getClassName(); int i = className.lastIndexOf(".") + 1; StringBuilder sb= new StringBuilder("[") .append(className.substring(i, className.length())) .append(".").append(stack.getMethodName()).append(" line:") .append(stack.getLineNumber()).append("]"); sb.append(" >>").append(content); Log.w(TAG, sb.toString()); } } }
文章标题:androidLOG打印-创新互联
当前地址:http://scyanting.com/article/csidoj.html