File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 50
50
//! }
51
51
//! ```
52
52
53
- use log:: { Level , LevelFilter , Metadata , Record } ;
53
+ mod op;
54
+ mod parser;
55
+
54
56
use std:: env;
55
57
use std:: fmt;
56
58
use std:: mem;
57
59
58
- mod op;
59
- mod parser;
60
+ use log:: { Level , LevelFilter , Metadata , Record } ;
61
+
62
+ use op:: FilterOp ;
63
+ use parser:: parse_spec;
60
64
61
65
/// A builder for a log filter.
62
66
///
@@ -80,7 +84,7 @@ mod parser;
80
84
/// ```
81
85
pub struct Builder {
82
86
directives : Vec < Directive > ,
83
- filter : Option < op :: FilterOp > ,
87
+ filter : Option < FilterOp > ,
84
88
built : bool ,
85
89
}
86
90
@@ -146,7 +150,7 @@ impl Builder {
146
150
///
147
151
/// [Enabling Logging]: ../index.html#enabling-logging
148
152
pub fn parse ( & mut self , filters : & str ) -> & mut Self {
149
- let ( directives, filter) = parser :: parse_spec ( filters) ;
153
+ let ( directives, filter) = parse_spec ( filters) ;
150
154
151
155
self . filter = filter;
152
156
@@ -221,7 +225,7 @@ struct Directive {
221
225
/// [`Builder`]: struct.Builder.html
222
226
pub struct Filter {
223
227
directives : Vec < Directive > ,
224
- filter : Option < op :: FilterOp > ,
228
+ filter : Option < FilterOp > ,
225
229
}
226
230
227
231
impl Filter {
Original file line number Diff line number Diff line change 1
1
use log:: LevelFilter ;
2
2
3
- use crate :: op;
4
3
use crate :: Directive ;
4
+ use crate :: FilterOp ;
5
5
6
6
/// Parse a logging specification string (e.g: "crate1,crate2::mod3,crate3::x=error/foo")
7
7
/// and return a vector with log directives.
8
- pub ( crate ) fn parse_spec ( spec : & str ) -> ( Vec < Directive > , Option < op :: FilterOp > ) {
8
+ pub ( crate ) fn parse_spec ( spec : & str ) -> ( Vec < Directive > , Option < FilterOp > ) {
9
9
let mut dirs = Vec :: new ( ) ;
10
10
11
11
let mut parts = spec. split ( '/' ) ;
@@ -63,7 +63,7 @@ pub(crate) fn parse_spec(spec: &str) -> (Vec<Directive>, Option<op::FilterOp>) {
63
63
}
64
64
}
65
65
66
- let filter = filter. and_then ( |filter| match op :: FilterOp :: new ( filter) {
66
+ let filter = filter. and_then ( |filter| match FilterOp :: new ( filter) {
67
67
Ok ( re) => Some ( re) ,
68
68
Err ( e) => {
69
69
eprintln ! ( "warning: invalid regex filter - {}" , e) ;
You can’t perform that action at this time.
0 commit comments