File tree 6 files changed +21
-18
lines changed 6 files changed +21
-18
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,11 @@ pre-release-replacements = [
37
37
]
38
38
39
39
[features ]
40
- default = [" termcolor" , " atty" , " humantime" , " regex" ]
40
+ default = [" auto-color" , " humantime" , " regex" ]
41
+ color = [" dep:termcolor" ]
42
+ auto-color = [" dep:atty" , " color" ]
43
+ humantime = [" dep:humantime" ]
44
+ regex = [" dep:regex" ]
41
45
42
46
[dependencies ]
43
47
log = { version = " 0.4.8" , features = [" std" ] }
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ mod permute;
2
2
mod task;
3
3
4
4
fn main ( ) {
5
- let features = [ "termcolor " , "humantime" , "atty " , "regex" ] ;
5
+ let features = [ "color " , "humantime" , "auto-color " , "regex" ] ;
6
6
7
7
// Run a default build
8
8
if !task:: test ( Default :: default ( ) ) {
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ $ export MY_LOG_STYLE=never
17
17
If you want to control the logging output completely, see the `custom_logger` example.
18
18
*/
19
19
20
- #[ cfg( all( feature = "termcolor " , feature = "humantime" ) ) ]
20
+ #[ cfg( all( feature = "color " , feature = "humantime" ) ) ]
21
21
fn main ( ) {
22
22
use env_logger:: { fmt:: Color , Builder , Env } ;
23
23
@@ -50,5 +50,5 @@ fn main() {
50
50
log:: info!( "a log from `MyLogger`" ) ;
51
51
}
52
52
53
- #[ cfg( not( all( feature = "termcolor " , feature = "humantime" ) ) ) ]
53
+ #[ cfg( not( all( feature = "color " , feature = "humantime" ) ) ) ]
54
54
fn main ( ) { }
Original file line number Diff line number Diff line change @@ -202,9 +202,9 @@ impl Builder {
202
202
}
203
203
}
204
204
205
- #[ cfg( feature = "termcolor " ) ]
205
+ #[ cfg( feature = "color " ) ]
206
206
type SubtleStyle = StyledValue < ' static , & ' static str > ;
207
- #[ cfg( not( feature = "termcolor " ) ) ]
207
+ #[ cfg( not( feature = "color " ) ) ]
208
208
type SubtleStyle = & ' static str ;
209
209
210
210
/// The default format.
@@ -233,7 +233,7 @@ impl<'a> DefaultFormat<'a> {
233
233
}
234
234
235
235
fn subtle_style ( & self , text : & ' static str ) -> SubtleStyle {
236
- #[ cfg( feature = "termcolor " ) ]
236
+ #[ cfg( feature = "color " ) ]
237
237
{
238
238
self . buf
239
239
. style ( )
@@ -242,7 +242,7 @@ impl<'a> DefaultFormat<'a> {
242
242
. clone ( )
243
243
. into_value ( text)
244
244
}
245
- #[ cfg( not( feature = "termcolor " ) ) ]
245
+ #[ cfg( not( feature = "color " ) ) ]
246
246
{
247
247
text
248
248
}
@@ -268,11 +268,11 @@ impl<'a> DefaultFormat<'a> {
268
268
}
269
269
270
270
let level = {
271
- #[ cfg( feature = "termcolor " ) ]
271
+ #[ cfg( feature = "color " ) ]
272
272
{
273
273
self . buf . default_styled_level ( record. level ( ) )
274
274
}
275
- #[ cfg( not( feature = "termcolor " ) ) ]
275
+ #[ cfg( not( feature = "color " ) ) ]
276
276
{
277
277
record. level ( )
278
278
}
Original file line number Diff line number Diff line change 1
1
/*
2
2
This internal module contains the terminal detection implementation.
3
3
4
- If the `atty` crate is available then we use it to detect whether we're
5
- attached to a particular TTY. If the `atty` crate is not available we
6
- assume we're not attached to anything. This effectively prevents styles
7
- from being printed.
4
+ If the `auto-color` feature is enabled then we detect whether we're attached to a particular TTY.
5
+ Otherwise, assume we're not attached to anything. This effectively prevents styles from being
6
+ printed.
8
7
*/
9
8
10
- #[ cfg( feature = "atty " ) ]
9
+ #[ cfg( feature = "auto-color " ) ]
11
10
mod imp {
12
11
pub ( in crate :: fmt) fn is_stdout ( ) -> bool {
13
12
atty:: is ( atty:: Stream :: Stdout )
@@ -18,7 +17,7 @@ mod imp {
18
17
}
19
18
}
20
19
21
- #[ cfg( not( feature = "atty " ) ) ]
20
+ #[ cfg( not( feature = "auto-color " ) ) ]
22
21
mod imp {
23
22
pub ( in crate :: fmt) fn is_stdout ( ) -> bool {
24
23
false
Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ Its public API is available when the `termcolor` crate is available.
5
5
The terminal printing is shimmed when the `termcolor` crate is not available.
6
6
*/
7
7
8
- #[ cfg_attr( feature = "termcolor " , path = "extern_impl.rs" ) ]
9
- #[ cfg_attr( not( feature = "termcolor " ) , path = "shim_impl.rs" ) ]
8
+ #[ cfg_attr( feature = "color " , path = "extern_impl.rs" ) ]
9
+ #[ cfg_attr( not( feature = "color " ) , path = "shim_impl.rs" ) ]
10
10
mod imp;
11
11
12
12
pub ( in crate :: fmt) use self :: imp:: * ;
You can’t perform that action at this time.
0 commit comments