-
Notifications
You must be signed in to change notification settings - Fork 144
Closed as not planned
Labels
Description
If I just do env_logger::init(); then I see colored log messages, as expected, with different color for every log leve.
However, if I use builder - everything is colorless, even though I call .write_style(WriteStyle::Always):
env_logger::builder()
.format(|buf, record| {
writeln!(
buf,
"{} [{}] - {}",
Local::now().format("%Y-%m-%d %H:%M:%S"),
record.level(),
record.args()
)
})
.write_style(WriteStyle::Always)
.filter(Some(botname), LevelFilter::Info)
.init();However, if I manually color all the text, like this:
env_logger::builder()
.format(|buf, record| {
let mut style = buf.style();
style.set_color(Color::Red);
writeln!(
buf,
"{} [{}] - {}",
Local::now().format("%Y-%m-%d %H:%M:%S"),
record.level(),
style.value(record.args())
)
})
.filter(Some(botname), LevelFilter::Info)
.write_style(WriteStyle::Always)
.init();red text is printed. Does it mean that if I want to use builder, I have to manually color all different levels?
Timmmm and moon-musick