File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,7 +37,11 @@ pre-release-replacements = [
3737]
3838
3939[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" ]
4145
4246[dependencies ]
4347log = { version = " 0.4.8" , features = [" std" ] }
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ mod permute;
22mod task;
33
44fn main ( ) {
5- let features = [ "termcolor " , "humantime" , "atty " , "regex" ] ;
5+ let features = [ "color " , "humantime" , "auto-color " , "regex" ] ;
66
77 // Run a default build
88 if !task:: test ( Default :: default ( ) ) {
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ $ export MY_LOG_STYLE=never
1717If you want to control the logging output completely, see the `custom_logger` example.
1818*/
1919
20- #[ cfg( all( feature = "termcolor " , feature = "humantime" ) ) ]
20+ #[ cfg( all( feature = "color " , feature = "humantime" ) ) ]
2121fn main ( ) {
2222 use env_logger:: { fmt:: Color , Builder , Env } ;
2323
@@ -50,5 +50,5 @@ fn main() {
5050 log:: info!( "a log from `MyLogger`" ) ;
5151}
5252
53- #[ cfg( not( all( feature = "termcolor " , feature = "humantime" ) ) ) ]
53+ #[ cfg( not( all( feature = "color " , feature = "humantime" ) ) ) ]
5454fn main ( ) { }
Original file line number Diff line number Diff line change @@ -202,9 +202,9 @@ impl Builder {
202202 }
203203}
204204
205- #[ cfg( feature = "termcolor " ) ]
205+ #[ cfg( feature = "color " ) ]
206206type SubtleStyle = StyledValue < ' static , & ' static str > ;
207- #[ cfg( not( feature = "termcolor " ) ) ]
207+ #[ cfg( not( feature = "color " ) ) ]
208208type SubtleStyle = & ' static str ;
209209
210210/// The default format.
@@ -233,7 +233,7 @@ impl<'a> DefaultFormat<'a> {
233233 }
234234
235235 fn subtle_style ( & self , text : & ' static str ) -> SubtleStyle {
236- #[ cfg( feature = "termcolor " ) ]
236+ #[ cfg( feature = "color " ) ]
237237 {
238238 self . buf
239239 . style ( )
@@ -242,7 +242,7 @@ impl<'a> DefaultFormat<'a> {
242242 . clone ( )
243243 . into_value ( text)
244244 }
245- #[ cfg( not( feature = "termcolor " ) ) ]
245+ #[ cfg( not( feature = "color " ) ) ]
246246 {
247247 text
248248 }
@@ -268,11 +268,11 @@ impl<'a> DefaultFormat<'a> {
268268 }
269269
270270 let level = {
271- #[ cfg( feature = "termcolor " ) ]
271+ #[ cfg( feature = "color " ) ]
272272 {
273273 self . buf . default_styled_level ( record. level ( ) )
274274 }
275- #[ cfg( not( feature = "termcolor " ) ) ]
275+ #[ cfg( not( feature = "color " ) ) ]
276276 {
277277 record. level ( )
278278 }
Original file line number Diff line number Diff line change 11/*
22This internal module contains the terminal detection implementation.
33
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.
87*/
98
10- #[ cfg( feature = "atty " ) ]
9+ #[ cfg( feature = "auto-color " ) ]
1110mod imp {
1211 pub ( in crate :: fmt) fn is_stdout ( ) -> bool {
1312 atty:: is ( atty:: Stream :: Stdout )
@@ -18,7 +17,7 @@ mod imp {
1817 }
1918}
2019
21- #[ cfg( not( feature = "atty " ) ) ]
20+ #[ cfg( not( feature = "auto-color " ) ) ]
2221mod imp {
2322 pub ( in crate :: fmt) fn is_stdout ( ) -> bool {
2423 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.
55The terminal printing is shimmed when the `termcolor` crate is not available.
66*/
77
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" ) ]
1010mod imp;
1111
1212pub ( in crate :: fmt) use self :: imp:: * ;
You can’t perform that action at this time.
0 commit comments