Log Util
来源:互联网 发布:跟谁学网络课程好吗 编辑:程序博客网 时间:2024/05/18 00:17
import android.util.Log;public class LogUtil {private static final boolean DEBUG = true;private static final boolean ERROR = true;private static final boolean INFO = true;private static final boolean WARN = true;public static void Info(Object i) { if ((i == null) || !INFO) { return; } Thread mThread = Thread.currentThread(); StackTraceElement[] mStackTrace = mThread.getStackTrace(); String mMethodName = mStackTrace[3].getMethodName(); String TAG = mStackTrace[3].getClassName(); i = "[" + mMethodName + "] " + i; Log.i(TAG, i + ""); }public static void Warn(Object w) { if ((w == null) || !WARN) { return; } Thread mThread = Thread.currentThread(); StackTraceElement[] mStackTrace = mThread.getStackTrace(); String mMethodName = mStackTrace[3].getMethodName(); String TAG = mStackTrace[3].getClassName(); w = "[" + mMethodName + "] " + w; Log.w(TAG, w + ""); }public static void Debug(Object d) { if ((d == null) || !DEBUG) { return; } Thread mThread = Thread.currentThread(); StackTraceElement[] mStackTrace = mThread.getStackTrace(); String mMethodName = mStackTrace[3].getMethodName(); String TAG = mStackTrace[3].getClassName(); d = "[" + mMethodName + "] " + d; Log.d(TAG, d + ""); }public static void DebugStack(Object d) { if ((d == null) || !DEBUG) { return; } Thread mThread = Thread.currentThread(); StackTraceElement[] mStackTrace = mThread.getStackTrace(); String mMethodName = mStackTrace[3].getMethodName(); String TAG = mStackTrace[3].getClassName(); d = "[" + mMethodName + "] " + d; Log.d(TAG, d + "", new RuntimeException()); }public static void Error(Object e) { if ((e == null) || !ERROR) { return; } Thread mThread = Thread.currentThread(); StackTraceElement[] mStackTrace = mThread.getStackTrace(); String mMethodName = mStackTrace[3].getMethodName(); String TAG = mStackTrace[3].getClassName(); e = "[" + mMethodName + "] " + e; Log.e(TAG, e + ""); }public static void In() { if (!INFO) { return; } Thread mThread = Thread.currentThread(); StackTraceElement[] mStackTrace = mThread.getStackTrace(); String mMethodName = mStackTrace[3].getMethodName(); String TAG = mStackTrace[3].getClassName(); String i = "in "+"[" + mMethodName + "]"; Log.i(TAG, i); }public static void Out() { if (!INFO) { return; } Thread mThread = Thread.currentThread(); StackTraceElement[] mStackTrace = mThread.getStackTrace(); String mMethodName = mStackTrace[3].getMethodName(); String TAG = mStackTrace[3].getClassName(); String i = "out "+"[" + mMethodName + "]"; Log.i(TAG, i); }}
0 0
- Log Util
- android.util.Log
- android.util.Log 类
- Android.util.Log
- android.util.Log
- android.util.log 使用方法
- Android日志工具Log(android.util.Log)
- android.util.Log图文详解
- Android.util的 Log类
- Android.util.Log 日志级别
- android.util.Log 日志级别
- android.util.log(Log.v()Log.d()Log.i()Log.w()和Log.e())
- android.util.Log常用的方法
- 【Android Util】全局控制Log打印日志
- android.util.Log常用的方法
- java.util.logging.Logger中log()
- IO.Util中的log(日志)
- 一个封装 android.util.Log 的Log类
- POJ-3669-Meteor Shower
- C#获取QQ聊天输入框中的内容
- IIS 7.0 ASP.NET应用程序生命周期
- 为什么说Parcelable 比Serializable更高效
- Step By Step(Lua环境)
- Log Util
- Air Raid hdu 1151 最小路径覆盖
- 一些关于各种CV的网站
- 指针和引用的区别
- 新浪微博SDK2.4授权信息保存
- Step By Step(Lua元表与元方法)
- android中invalidate()的使用小结
- Emgu CV 库:.NET平台下对OpenCV 图像处理库的封装
- Step By Step(Lua数据持久化)