@@ -15,39 +15,43 @@ this library:
15
15
android_logger = " 0.8.1"
16
16
```
17
17
18
- Example of initialization on activity creation, with log filters :
18
+ Example of initialization on activity creation, with log configuration :
19
19
20
20
``` rust
21
21
#[macro_use] extern crate log;
22
22
extern crate android_logger;
23
23
24
24
use log :: Level ;
25
- use android_logger :: Filter ;
25
+ use android_logger :: { Config , FilterBuilder } ;
26
26
27
27
fn native_activity_create () {
28
28
android_logger :: init_once (
29
- Filter :: default ()
29
+ Config :: default ()
30
30
. with_min_level (Level :: Trace ) // limit log level
31
- . with_allowed_module_path (" hello::crate" ), // limit messages to specific crate
32
- Some (" mytag" ) // logs will show under mytag tag. If `None`, the crate name will be used
31
+ . with_tag (" mytag" ) // logs will show under mytag tag
32
+ . with_filter ( // configure messages for specific crate
33
+ FilterBuilder :: new ()
34
+ . parse (" debug,hello::crate=error" )
35
+ . build ())
33
36
);
34
37
35
38
trace! (" this is a verbose {}" , " message" );
36
39
error! (" this is printed by default" );
37
40
}
38
41
```
39
42
40
- To allow all logs, use the default filter with min level Trace:
43
+ To allow all logs, use the default configuration with min level Trace:
41
44
42
45
``` rust
43
46
#[macro_use] extern crate log;
44
47
extern crate android_logger;
45
48
46
49
use log :: Level ;
47
- use android_logger :: Filter ;
50
+ use android_logger :: Config ;
48
51
49
52
fn native_activity_create () {
50
- android_logger :: init_once (Filter :: default (). with_min_level (Level :: Trace ), None );
53
+ android_logger :: init_once (
54
+ Config :: default (). with_min_level (Level :: Trace ));
51
55
}
52
56
```
53
57
0 commit comments