android orhanobut logger打印那个类第几行调用log输出,在输出日志上上点击跳转到源代码

orhanobut的Logger是一个简单、强大且美观的Android日志工具,提供线程、类和方法信息,支持JSON美化输出,并能直接跳转到源代码。初始化Logger后,可以通过设置改变TAG、调整方法调用深度和堆栈偏移,甚至隐藏线程信息。在捕获异常时,Logger能清晰显示异常原因。
摘要由CSDN通过智能技术生成


Logger is a android printing utils , It can print  the calling  method's thread info and formatting json content 。the infos contain line postion,you can point the link to jump。

Logger 是一个 android log 输入库,他能够在输入输出点的方法信息、线程信息、格式化json输入,方法信息中包含行数。还可以从android studio logcat中点击链接跳转到代码行数。

tips:
1. the init method prams is the TAG you want print。defalut value is “PRETTRYLOGGER”;
eg: Logger.init("maoqis"); 
2. you can set the count of you want print stack info above you calling position.
    I debug a demo,found by StackTraceElment to get method infomation

    
    
    

 the demo  stackoffset is  5 at the Logger.java 49 line. print 3 method above it.
 从堆栈的第三位开始遍历stackTraceElement 发现不是Logger 自己使用的类位置从而找到调用者调用的方法位置。


Logger

Simple, pretty and powerful logger for android

Logger provides :

  • Thread information
  • Class information
  • Method information
  • Pretty-print for json content
  • Pretty-print for new line "\n"
  • Clean output
  • Jump to source

Dependency

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值