[−][src]Struct fern::colors::ColoredLevelConfig
Configuration specifying colors a log level can be colored as.
Example usage setting custom 'info' and 'debug' colors:
use fern::colors::{Color, ColoredLevelConfig}; let colors = ColoredLevelConfig::new() .info(Color::Green) .debug(Color::Magenta); fern::Dispatch::new() .format(move |out, message, record| { out.finish(format_args!( "[{}] {}", colors.color(record.level()), message )) }) .chain(std::io::stdout()) .apply()?;
Fields
error: Color
The color to color logs with the Error
level.
warn: Color
The color to color logs with the Warn
level.
info: Color
The color to color logs with the Info
level.
debug: Color
The color to color logs with the Debug
level.
trace: Color
The color to color logs with the Trace
level.
Methods
impl ColoredLevelConfig
[src]
pub fn new() -> Self
[src]
Creates a new ColoredLevelConfig with the default colors.
This matches the behavior of ColoredLevelConfig::default
.
pub fn error(self, error: Color) -> Self
[src]
Overrides the Error
level color with the given color.
The default color is Color::Red
.
pub fn warn(self, warn: Color) -> Self
[src]
Overrides the Warn
level color with the given color.
The default color is Color::Yellow
.
pub fn info(self, info: Color) -> Self
[src]
Overrides the Info
level color with the given color.
The default color is Color::White
.
pub fn debug(self, debug: Color) -> Self
[src]
Overrides the Debug
level color with the given color.
The default color is Color::White
.
pub fn trace(self, trace: Color) -> Self
[src]
Overrides the Trace
level color with the given color.
The default color is Color::White
.
pub fn color(&self, level: Level) -> WithFgColor<Level>
[src]
Colors the given log level with the color in this configuration corresponding to it's level.
The structure returned is opaque, but will print the Level surrounded
by ANSI color codes when displayed. This will work correctly for
UNIX terminals, but due to a lack of support from the colored
crate, this will not function in Windows.
pub fn get_color(&self, level: &Level) -> Color
[src]
Retrieves the color that a log level should be colored as.
Trait Implementations
impl Copy for ColoredLevelConfig
[src]
impl Default for ColoredLevelConfig
[src]
fn default() -> Self
[src]
Retrieves the default configuration. This has:
Error
asColor::Red
Warn
asColor::Yellow
Info
asColor::White
Debug
asColor::White
Trace
asColor::White
impl Clone for ColoredLevelConfig
[src]
fn clone(&self) -> ColoredLevelConfig
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl Unpin for ColoredLevelConfig
impl Sync for ColoredLevelConfig
impl Send for ColoredLevelConfig
impl UnwindSafe for ColoredLevelConfig
impl RefUnwindSafe for ColoredLevelConfig
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,