◆elvishew/xLog
框架特性介绍
Global config(tag, formatters...) orlog-based config
Support printing any object andcustomizable object formatter
Support printing array
Support printing long log (No 4Klimitation)
XML and JSON formatted
Thread information (Thread name etc. Can becustomized)
Stack trace information (Configurable callstack depth, with file name, method name, line number)
Support log interceptors
Save logs in file (Configurable file namingand backup strategy)
Good looking in Android Studio
Easy to use, powerful in customization
xLog支持数组、object、XML、JSON等数据格式打印,支持Log保存本地,支持log级别控制。及格式化打印配置。
代码部分
集成到项目:
S1.添加依赖 compile 'com.elvishew:xlog:1.4.0'或导入library源码库;
S2.初始化log;
S3.调用log;
API:
初始化
LogConfiguration config = new LogConfiguration.Builder()
.logLevel(BuildConfig.DEBUG ? LogLevel.ALL // Specify log level, logs below this level won't be printed, default: LogLevel.ALL
: LogLevel.NONE)
.tag("MY_TAG") // Specify TAG, default: "X-LOG"
.t() // Enable thread info, disabled by default
.st(2) // Enable stack trace info with depth 2, disabled by default
.b() // Enable