阅读目录
- 支持直接打印数据集合,如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<Person> list1 =
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