Skip to content

Commit

Permalink
Auto merge of #12542 - epage:trace, r=weihanglo
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Aug 23, 2023
2 parents 2cc50bc + 488c210 commit 0c51462
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/xtask-bump-check/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fn setup_logger() {
let env = tracing_subscriber::EnvFilter::from_env("CARGO_LOG");

tracing_subscriber::fmt()
.with_timer(tracing_subscriber::fmt::time::Uptime::default())
.with_ansi(std::io::IsTerminal::is_terminal(&std::io::stderr()))
.with_writer(std::io::stderr)
.with_env_filter(env)
Expand Down
2 changes: 2 additions & 0 deletions src/bin/cargo/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ fn setup_logger() {
let env = tracing_subscriber::EnvFilter::from_env("CARGO_LOG");

tracing_subscriber::fmt()
.with_timer(tracing_subscriber::fmt::time::Uptime::default())
.with_ansi(std::io::IsTerminal::is_terminal(&std::io::stderr()))
.with_writer(std::io::stderr)
.with_env_filter(env)
.init();
tracing::trace!(start = humantime::format_rfc3339(std::time::SystemTime::now()).to_string());
}

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

0 comments on commit 0c51462

Please sign in to comment.