-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from JarrettBillingsley/master
Customizable level label colors
- Loading branch information
Showing
6 changed files
with
90 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use log::*; | ||
use simplelog::*; | ||
|
||
#[cfg(feature = "termcolor")] | ||
fn main() { | ||
let config = ConfigBuilder::new() | ||
.set_level_color(Level::Error, Color::Magenta) | ||
.set_level_color(Level::Trace, Color::Green) | ||
.build(); | ||
|
||
TermLogger::init(LevelFilter::Trace, config, TerminalMode::Stdout).unwrap(); | ||
error!("Magenta error"); | ||
warn!("Yellow warning"); | ||
info!("Blue info"); | ||
debug!("Cyan debug"); | ||
trace!("Green trace"); | ||
} | ||
|
||
#[cfg(not(feature = "termcolor"))] | ||
fn main() { | ||
println!("this example requires the termcolor feature."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use log::*; | ||
use simplelog::*; | ||
|
||
#[cfg(feature = "termcolor")] | ||
fn main() { | ||
TermLogger::init(LevelFilter::Trace, Config::default(), TerminalMode::Stdout).unwrap(); | ||
error!("Red error"); | ||
warn!("Yellow warning"); | ||
info!("Blue info"); | ||
debug!("Cyan debug"); | ||
trace!("White trace"); | ||
} | ||
|
||
#[cfg(not(feature = "termcolor"))] | ||
fn main() { | ||
println!("this example requires the termcolor feature."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use log::*; | ||
use simplelog::*; | ||
|
||
#[cfg(all(not(target_family = "windows"), feature = "termcolor"))] | ||
fn main() { | ||
let config = ConfigBuilder::new() | ||
.set_level_color(Level::Error, Color::Rgb(191, 0, 0)) | ||
.set_level_color(Level::Warn, Color::Rgb(255, 127, 0)) | ||
.set_level_color(Level::Info, Color::Rgb(192, 192, 0)) | ||
.set_level_color(Level::Debug, Color::Rgb(63, 127, 0)) | ||
.set_level_color(Level::Trace, Color::Rgb(127, 127, 255)) | ||
.build(); | ||
|
||
TermLogger::init(LevelFilter::Trace, config, TerminalMode::Stdout).unwrap(); | ||
error!("Red error"); | ||
warn!("Orange warning"); | ||
info!("Yellow info"); | ||
debug!("Dark green debug"); | ||
trace!("Light blue trace"); | ||
} | ||
|
||
#[cfg(any(target_family = "windows", not(feature = "termcolor")))] | ||
fn main() { | ||
println!("this example requires the termcolor feature and a non-Windows OS."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters