Don't color logs on Windows if enabling ASCII escapes fails.

This commit is contained in:
Sergio Benitez 2018-07-05 17:54:19 -07:00
parent bd6cdecf00
commit 7b4b0646c5
1 changed files with 3 additions and 3 deletions

View File

@ -135,10 +135,8 @@ impl log::Log for RocketLogger {
}
pub(crate) fn try_init(level: LoggingLevel, verbose: bool) {
if !::isatty::stdout_isatty() {
if !::isatty::stdout_isatty() || (cfg!(windows) && !Paint::enable_windows_ascii()) {
Paint::disable();
} else if cfg!(windows) {
Paint::enable_windows_ascii();
}
push_max_level(level);
@ -146,6 +144,8 @@ pub(crate) fn try_init(level: LoggingLevel, verbose: bool) {
if verbose {
eprintln!("Logger failed to initialize: {}", e);
}
pop_max_level();
}
}