LogUtils:一个强大的Android日志管理器,支持对象、List、Map、数组等输出
16lz
2021-01-26
阅读目录
- screenshot
- options
- 支持直接打印数据集合,如List、Set、Map、数组等
- 全局配置log输出
- 不需要设置tag
- 准确显示调用方法、行,快速定位所在文件位置.
screenshot
日志说明
打印数据列表
打印数组
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | // 输出字符串 LogUtils.d( "12345" ); // 输出参数 LogUtils.d( "12%s3%d45" , "a" , 0 ); // 输出异常 LogUtils.d( new NullPointerException( "12345" )); // 输出对象 Person person = new Person(); person.setAge( 11 ); person.setName( "pengwei" ); person.setScore( 37 .5f); LogUtils.d(person); // 对象为空 LogUtils.d( null ); // 输出json(json默认debug打印) String json = "{'a':'b','c':{'aa':234,'dd':{'az':12}}}" ; LogUtils.json(json); // 打印数据集合 List new ArrayList<>(); for ( int i = 0 ; i < 4 ; i++){ list1.add(person); } LogUtils.d(list1); // 打印数组 double [][] doubles = {{ 1.2 , 1.6 , 1.7 , 30 , 33 }, { 1.2 , 1.6 , 1.7 , 30 , 33 }, { 1.2 , 1.6 , 1.7 , 30 , 33 }, { 1.2 , 1.6 , 1.7 , 30 , 33 }}; LogUtils.d(doubles); // 其他用法 LogUtils.v( "12345" ); LogUtils.i( "12345" ); LogUtils.w( "12345" ); LogUtils.e( "12345" ); LogUtils.wtf( "12345" ); |
回到顶部
options
?1 2 3 4 5 | // 配置日志是否输出(默认true) LogUtils.configAllowLog = false ; // 配置日志前缀 LogUtils.configTagPrefix = "abc-" ; |
compile 'com.apkfuns.logutils:library:1.0.4'
? 1 2 3 4 5 | < dependency > < groupId >com.apkfuns.logutils groupId > < artifactId >library artifactId > < version >1.0.4 version > dependency > |
click here to download sources.jar
History
- 1.0.0 (2015/07/13)
- 打印对象,字符串,异常,且显示文件行数
- 1.0.1 (2015/07/22)
- 打印json字符串
- 1.0.2 (2015/07/24)
- 支持打印List、Se等数据集合
- 1.0.3 (2015/07/24)
- 支持打印Map集合
- 1.0.4 (2015/07/25)
- 支持打印数组(暂仅支持一维、二维数组)
- Blog: apkfuns.com
- Email: pengwei1024@gmail.com
更多相关文章
- android中string.xml中%1$s、%1$d等的用法
- ORM 框架之greenDAO
- Android字节、十进制、十六进制、字符串之间的相互转换
- android java数组应用与说明
- 自学Android,学多久可以加入字节跳动?
- Android学习14--Android应用资源
- 使用Qt开发Android应用程序(Qt on Android),连接安卓手机真机调试时
- 实用的Log打印类封装,助尼快速定位源码(android)
- 这可能是最好的 Android/Kotlin日志输出方法