Skip to content

Commit 169b958

Browse files
committed
Rename colored feature to proper colors feature
1 parent b289a46 commit 169b958

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/lib.rs

+14-11
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
3131
#![cfg_attr(feature = "nightly", feature(thread_id_value))]
3232

33-
#[cfg(feature = "colored")]
33+
#[cfg(feature = "colors")]
3434
use colored::*;
3535
use log::{Level, LevelFilter, Log, Metadata, Record, SetLoggerError};
3636
use std::{collections::HashMap, str::FromStr};
@@ -88,7 +88,7 @@ pub struct SimpleLogger {
8888
/// Whether to use color output or not.
8989
///
9090
/// This field is only available if the `color` feature is enabled.
91-
#[cfg(feature = "colored")]
91+
#[cfg(feature = "colors")]
9292
colors: bool,
9393
}
9494

@@ -118,7 +118,7 @@ impl SimpleLogger {
118118
#[cfg(feature = "timestamps")]
119119
timestamps_format: None,
120120

121-
#[cfg(feature = "colored")]
121+
#[cfg(feature = "colors")]
122122
colors: true,
123123
}
124124
}
@@ -331,7 +331,7 @@ impl SimpleLogger {
331331
///
332332
/// This method is only available if the `colored` feature is enabled.
333333
#[must_use = "You must call init() to begin logging"]
334-
#[cfg(feature = "colored")]
334+
#[cfg(feature = "colors")]
335335
pub fn with_colors(mut self, colors: bool) -> SimpleLogger {
336336
self.colors = colors;
337337
self
@@ -380,7 +380,7 @@ impl Log for SimpleLogger {
380380
fn log(&self, record: &Record) {
381381
if self.enabled(record.metadata()) {
382382
let level_string = {
383-
#[cfg(feature = "colored")]
383+
#[cfg(feature = "colors")]
384384
{
385385
if self.colors {
386386
match record.level() {
@@ -394,7 +394,7 @@ impl Log for SimpleLogger {
394394
format!("{:<5}", record.level().to_string())
395395
}
396396
}
397-
#[cfg(not(feature = "colored"))]
397+
#[cfg(not(feature = "colors"))]
398398
{
399399
format!("{:<5}", record.level().to_string())
400400
}
@@ -484,7 +484,7 @@ impl Log for SimpleLogger {
484484
/// Configure the console to display colours - Windows + colored
485485
///
486486
/// This is only needed on Windows when using the 'colored' feature.
487-
#[cfg(all(windows, feature = "colored"))]
487+
#[cfg(all(windows, feature = "colors"))]
488488
pub fn set_up_color_terminal() {
489489
use std::io::{stdout, IsTerminal};
490490

@@ -516,17 +516,20 @@ pub fn set_up_color_terminal() {
516516
/// Configure the console to display colours - Windows + !colored
517517
///
518518
/// 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")))]
520520
pub fn set_up_color_terminal() {}
521521

522522
/// Configure the console to display colours - !Windows + stderr + colors
523523
///
524524
/// The colored crate will disable colors when stdout is not a terminal. This method overrides this
525525
/// behaviour to check the status of stderr instead.
526-
#[cfg(all(not(windows), feature = "stderr", feature = "colored"))]
526+
#[cfg(all(not(windows), feature = "stderr"))]
527527
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+
}
530533
}
531534

532535
/// Configure the console to display colours - !Windows + !stderr

0 commit comments

Comments
 (0)