-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(log): enable ansi color only in terminal #12488
Conversation
r? @epage (rustbot has picked a reviewer for you, use r? to override) |
IIUC, this is aligned with how |
Currently blocked on rust-lang/rust#114804. While we can switch from main.rs to an empty lib.rs to bypass that, I do think this is a good test to catch this kind of subtle change. diff --git a/tests/testsuite/future_incompat_report.rs b/tests/testsuite/future_incompat_report.rs
index 9f451a64c..4d2c66d17 100644
--- a/tests/testsuite/future_incompat_report.rs
+++ b/tests/testsuite/future_incompat_report.rs
@@ -164,7 +164,7 @@ fn test_multi_crate() {
second-dep = "*"
"#,
)
- .file("src/main.rs", "fn main() {}")
+ .file("src/lib.rs", "")
.build();
for command in &["build", "check", "rustc", "test"] { |
fd14f5f
to
c07043b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r= me when this is able to go through
Thank you for the review! @bors r+ |
@bors r- |
fix(log): enable ansi color only in terminal
@bors r=epage |
☀️ Test successful - checks-actions |
Update cargo 6 commits in 7e9de3f4ec3708f500bec142317895b96131e47c..7c3904d6c3ed54e8a413023519b55a536ad44d5b 2023-08-13 00:47:32 +0000 to 2023-08-14 20:11:43 +0000 - fix(lints): Doctest extraction should respect `[lints]` (rust-lang/cargo#12501) - test: relax assertions of panic message (again) (rust-lang/cargo#12500) - doc(unstable): `cargo test` does not provide `--keep-going` (rust-lang/cargo#12492) - fix(log): enable ansi color only in terminal (rust-lang/cargo#12488) - Update cargo-yank.md (rust-lang/cargo#12490) - test: bypass `rustc --test` impl details for `-Zfuture-incompat-test` (rust-lang/cargo#12491) r? `@ghost`
Update cargo 6 commits in 7e9de3f4ec3708f500bec142317895b96131e47c..7c3904d6c3ed54e8a413023519b55a536ad44d5b 2023-08-13 00:47:32 +0000 to 2023-08-14 20:11:43 +0000 - fix(lints): Doctest extraction should respect `[lints]` (rust-lang/cargo#12501) - test: relax assertions of panic message (again) (rust-lang/cargo#12500) - doc(unstable): `cargo test` does not provide `--keep-going` (rust-lang/cargo#12492) - fix(log): enable ansi color only in terminal (rust-lang/cargo#12488) - Update cargo-yank.md (rust-lang/cargo#12490) - test: bypass `rustc --test` impl details for `-Zfuture-incompat-test` (rust-lang/cargo#12491) r? `@ghost`
Update cargo 6 commits in 7e9de3f4ec3708f500bec142317895b96131e47c..7c3904d6c3ed54e8a413023519b55a536ad44d5b 2023-08-13 00:47:32 +0000 to 2023-08-14 20:11:43 +0000 - fix(lints): Doctest extraction should respect `[lints]` (rust-lang/cargo#12501) - test: relax assertions of panic message (again) (rust-lang/cargo#12500) - doc(unstable): `cargo test` does not provide `--keep-going` (rust-lang/cargo#12492) - fix(log): enable ansi color only in terminal (rust-lang/cargo#12488) - Update cargo-yank.md (rust-lang/cargo#12490) - test: bypass `rustc --test` impl details for `-Zfuture-incompat-test` (rust-lang/cargo#12491) r? `@ghost`
What does this PR try to resolve?
In #12458 we introduced
tracing
but forgot to consult if it is in tty to enable color logs.How should we test and review this PR?
cargo tree &> log
and check iflog
file contains any ansi color code.Additional information
I'll hold off
CARGO_LOG
respecting--color=always
for now.#9012 is something can be resolved as a whole.
tracing_subscriber::reload
is also a thing to consider, so that we can configure logging color and output file after loadingconfig.toml