-
Notifications
You must be signed in to change notification settings - Fork 731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ANSI broken on Windows 10 #445
Comments
@andrewbanchich hmm. We're currently using the |
@hawkw It does handle it (see the link I posted) but just not by default. |
Ah, sorry, I misinterpreted your comment (and didn't click the link), my bad. I think we probably want to do that when constructing the subscriber if the target OS is windows, then? |
That makes sense to me. I'll give this a shot and have a pull request soon. |
I'm fine with switching to tracing/tracing-subscriber/src/fmt/format/mod.rs Lines 550 to 559 in 8711f63
with a no-op Style type when ansi-term is disabled:tracing/tracing-subscriber/src/fmt/format/mod.rs Lines 592 to 603 in 8711f63
We can probably do a similar thing with |
hmm, upon taking a closer look, it looks like A big part of how we've optimized the performance of logging events is by avoiding additional string allocations, and writing directly to the buffer, which is reused without deallocating — in many cases, once the buffer is "warmed up" (i.e. it has previously allocated enough length to hold the line we are currently writing), logging an event should be allocation-free. It seems like switching to |
termcolor has a buffer type which supports writing colored text to a buffer and clearing afterwards to preserve the allocations. Maybe that would be suitable here? |
termcolor also supports Windows 7 and 8 according to rust-lang/rust#55769, while ansi-term only works on Windows 10+. Edit: anstream also has legacy Windows support, and is possibly a better choice than termcolor: rust-lang/cargo#12627 |
ansi_term
requires Windows 10 programs to explicitly enable ANSI support.Without doing this, using
cargo run
orcargo run --release
displaytracing
logs correctly, but when running the binary installed withcargo install --path .
it results in broken ANSI strings.Is this something you think
tracing
should fix out of the box, should just be communicated in the docs?The text was updated successfully, but these errors were encountered: