Skip to content

Commit 0c51462

Browse files
committed
Auto merge of #12542 - epage:trace, r=weihanglo
fix(log): Use a more compact relative-time format This changes logged messages from ``` 2023-08-23T01:01:59.922018Z DEBUG cargo::core::compiler::fingerprint: filesystem up-to-date "/home/epage/src/personal/dump" ``` To ``` 0.041729583s DEBUG cargo::core::compiler::fingerprint: filesystem up-to-date "/home/epage/src/personal/dump" ``` Benefits - Less horizontal space taken up in boilerplate - Easier to compare within a run Downsides - Harder to correlate with other processes, like with crates.io server operations This gives us up to 4 digits for seconds which should be sufficient for cargo build times. We could make this more compact by dropping the digits of precision from 9 to 6 but that would require a custom Timer which might be a paint to keep in sync between packages.
2 parents 2cc50bc + 488c210 commit 0c51462

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

crates/xtask-bump-check/src/main.rs

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ fn setup_logger() {
2020
let env = tracing_subscriber::EnvFilter::from_env("CARGO_LOG");
2121

2222
tracing_subscriber::fmt()
23+
.with_timer(tracing_subscriber::fmt::time::Uptime::default())
2324
.with_ansi(std::io::IsTerminal::is_terminal(&std::io::stderr()))
2425
.with_writer(std::io::stderr)
2526
.with_env_filter(env)

src/bin/cargo/main.rs

+2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ fn setup_logger() {
4141
let env = tracing_subscriber::EnvFilter::from_env("CARGO_LOG");
4242

4343
tracing_subscriber::fmt()
44+
.with_timer(tracing_subscriber::fmt::time::Uptime::default())
4445
.with_ansi(std::io::IsTerminal::is_terminal(&std::io::stderr()))
4546
.with_writer(std::io::stderr)
4647
.with_env_filter(env)
4748
.init();
49+
tracing::trace!(start = humantime::format_rfc3339(std::time::SystemTime::now()).to_string());
4850
}
4951

5052
/// Table for defining the aliases which come builtin in `Cargo`.

0 commit comments

Comments
 (0)