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