30
30
31
31
#![ cfg_attr( feature = "nightly" , feature( thread_id_value) ) ]
32
32
33
- #[ cfg( feature = "colored " ) ]
33
+ #[ cfg( feature = "colors " ) ]
34
34
use colored:: * ;
35
35
use log:: { Level , LevelFilter , Log , Metadata , Record , SetLoggerError } ;
36
36
use std:: { collections:: HashMap , str:: FromStr } ;
@@ -88,7 +88,7 @@ pub struct SimpleLogger {
88
88
/// Whether to use color output or not.
89
89
///
90
90
/// This field is only available if the `color` feature is enabled.
91
- #[ cfg( feature = "colored " ) ]
91
+ #[ cfg( feature = "colors " ) ]
92
92
colors : bool ,
93
93
}
94
94
@@ -118,7 +118,7 @@ impl SimpleLogger {
118
118
#[ cfg( feature = "timestamps" ) ]
119
119
timestamps_format : None ,
120
120
121
- #[ cfg( feature = "colored " ) ]
121
+ #[ cfg( feature = "colors " ) ]
122
122
colors : true ,
123
123
}
124
124
}
@@ -331,7 +331,7 @@ impl SimpleLogger {
331
331
///
332
332
/// This method is only available if the `colored` feature is enabled.
333
333
#[ must_use = "You must call init() to begin logging" ]
334
- #[ cfg( feature = "colored " ) ]
334
+ #[ cfg( feature = "colors " ) ]
335
335
pub fn with_colors ( mut self , colors : bool ) -> SimpleLogger {
336
336
self . colors = colors;
337
337
self
@@ -380,7 +380,7 @@ impl Log for SimpleLogger {
380
380
fn log ( & self , record : & Record ) {
381
381
if self . enabled ( record. metadata ( ) ) {
382
382
let level_string = {
383
- #[ cfg( feature = "colored " ) ]
383
+ #[ cfg( feature = "colors " ) ]
384
384
{
385
385
if self . colors {
386
386
match record. level ( ) {
@@ -394,7 +394,7 @@ impl Log for SimpleLogger {
394
394
format ! ( "{:<5}" , record. level( ) . to_string( ) )
395
395
}
396
396
}
397
- #[ cfg( not( feature = "colored " ) ) ]
397
+ #[ cfg( not( feature = "colors " ) ) ]
398
398
{
399
399
format ! ( "{:<5}" , record. level( ) . to_string( ) )
400
400
}
@@ -484,7 +484,7 @@ impl Log for SimpleLogger {
484
484
/// Configure the console to display colours - Windows + colored
485
485
///
486
486
/// This is only needed on Windows when using the 'colored' feature.
487
- #[ cfg( all( windows, feature = "colored " ) ) ]
487
+ #[ cfg( all( windows, feature = "colors " ) ) ]
488
488
pub fn set_up_color_terminal ( ) {
489
489
use std:: io:: { stdout, IsTerminal } ;
490
490
@@ -516,17 +516,20 @@ pub fn set_up_color_terminal() {
516
516
/// Configure the console to display colours - Windows + !colored
517
517
///
518
518
/// This method does nothing if running on Windows with the colored feature disabled.
519
- #[ cfg( all( windows, not( feature = "colored " ) ) ) ]
519
+ #[ cfg( all( windows, not( feature = "colors " ) ) ) ]
520
520
pub fn set_up_color_terminal ( ) { }
521
521
522
522
/// Configure the console to display colours - !Windows + stderr + colors
523
523
///
524
524
/// The colored crate will disable colors when stdout is not a terminal. This method overrides this
525
525
/// behaviour to check the status of stderr instead.
526
- #[ cfg( all( not( windows) , feature = "stderr" , feature = "colored" ) ) ]
526
+ #[ cfg( all( not( windows) , feature = "stderr" ) ) ]
527
527
pub fn set_up_color_terminal ( ) {
528
- use std:: io:: { stderr, IsTerminal } ;
529
- colored:: control:: set_override ( stderr ( ) . is_terminal ( ) ) ;
528
+ #[ cfg( feature = "colors" ) ]
529
+ {
530
+ use std:: io:: { stderr, IsTerminal } ;
531
+ colored:: control:: set_override ( stderr ( ) . is_terminal ( ) ) ;
532
+ }
530
533
}
531
534
532
535
/// Configure the console to display colours - !Windows + !stderr
0 commit comments