package com.lurencun.android.system;

import android.util.Log;

public class ExLog {

	static final String TAG = ExLog.class.getSimpleName();

	/**
* 输出调试信息(System.out),并在调试输入信息中附带当前代码在哪个类哪一行的额外数据。
* @param message 调试信息
*/
public static void l(String message){
StackTraceElement ele = Thread.currentThread().getStackTrace()[3];
int line = ele.getLineNumber();
String clazz = ele.getClassName();
System.out.println(":::: @"+clazz+" -> "+line+" :::: "+message);
} /**
* 取得当前代码所在的方法名
* @return 当前方法名
*/
public static String getCurrentMethodName(){
// 0 getThreadStackTrce
// 1 getStackTrace
// 2 * this method: getCurrentMethodName
// 3 your method
return Thread.currentThread().getStackTrace()[3].getMethodName();
} /**
* 输出方法调用链
* @param object 对象
*/
public static void logCurrentMethodChain(Object object){
StackTraceElement[] es = Thread.currentThread().getStackTrace();
long time = System.currentTimeMillis();
Log.d(TAG, String.format("###### Object(%s) Method Chain ###### @Time( %d )", object.getClass().getSimpleName(), time));
for(StackTraceElement e : es){
String msg = String.format("### Method Chain ### Caller:%s ->:%s", e.getClassName(),e.getMethodName());
Log.d(TAG, msg);
}
} /**
* 输出当前方法调用
* @param object 对象
*/
public static void logCurrentMethod(Object object){
String methodName = Thread.currentThread().getStackTrace()[3].getMethodName();
long time = System.currentTimeMillis();
String msg = String.format("###### Calling Method ###### Object(%s) -> %s @Time( %d )", object.getClass().getSimpleName(),methodName, time);
Log.d(TAG, msg);
} }

最新文章

  1. CST时间转换成 yyyy-MM-dd格式
  2. centos更改默认语言
  3. 李洪强iOS开发之宏定义方法来初始化一个单例对象
  4. algorithm@ find the shortest path in a graph using BFS
  5. ios 字符串替换方法
  6. Tomcat8 配置Oracle11g数据源
  7. poj 3320 Jessica's Reading Problem(尺取法)
  8. CentOS6.5与XP双系统安装
  9. jsp获取枚举的值
  10. redis中的事务
  11. 测试与发布(Alpha版本)
  12. Eclipse背景颜色改动
  13. 8_python连接数据库
  14. 《阿里巴巴Android编码规范》阅读纪要(二)
  15. python中pip升级
  16. mysql 创建数据库,添加用户,用户授权
  17. w​i​n​d​o​w​s​ ​s​e​r​v​e​r​ ​2​0​0​8​ ​r​2​ ​启​用​索​引(转)
  18. [Ubuntu] geoip-bin 程序包 - 查询 IP 归属地
  19. 为什么使彩色图变灰RGB的权重会固定(R:0.299 G:0.587 B:0.114)?
  20. 网页方式访问 QQ 小说书架

热门文章

  1. Memory Cache(内存缓存)
  2. 使用SignalR实现比特币价格实时刷新
  3. 15个顶级Java多线程面试题及答案
  4. Spring+Quartz 整合一:常规整合
  5. 总结:常用的Linux系统监控命令
  6. MAT(2)安装Memory Analyzer
  7. Jeecms自定义标签用法[单个内容]
  8. [PoC]某B2B网站的一个反射型XSS漏洞
  9. c++的操作符格式记录
  10. jeewx的使用_02 解析微信服务器post过来的数据