Fix color settings for logger (#6285)

Signed-off-by: nibon7 <nibon7@163.com>
This commit is contained in:
nibon7 2022-08-10 19:52:11 +08:00 committed by GitHub
parent 271fda7c91
commit c74254c2cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -97,8 +97,11 @@ pub fn configure(
let log_target = LogTarget::from(target);
// Only TermLogger supports color output
if !matches!(log_target, LogTarget::File) {
set_colored_level(builder, level);
if matches!(
log_target,
LogTarget::Stdout | LogTarget::Stderr | LogTarget::Mixed
) {
Level::iter().for_each(|level| set_colored_level(builder, level));
}
(level.to_level_filter(), log_target)