Skip to content

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Sep 12, 2025

This switches to using the tracing crate instead of log. Tracing provides a lot of nice features which we can take advantage of moving forward.

This also adjusts the output fairly significantly. This includes:

  • Switched the environment variable from RUST_LOG to MDBOOK_LOG.
  • Dropped the timestamp. I experimented with various different time displays, but ultimately decided to omit it for now. I don't think I've ever found it to be useful, and it takes up a very significant amount of space. It could potentially be useful for basic profiling, but I think there are other, better mechanisms for that. We could consider leveraging tracing itself for doing some basic profiling (like using something like tracing-chrome).
  • Dropped the target unless MDBOOK_LOG is set. The target tends to be pretty noisy, and doesn't really convey much information unless you are debugging or otherwise trying to adjust the log output.
  • Added color.
  • Slightly reworked the way the error cause trace is displayed.
  • Slightly changed the way html5ever filtering is done, as well as add handlebars to the list since they both are very noisy. You can override this now by explicitly listing them as targets.

I still expect that mdbook will eventually change how it displays things to the console, possibly switching away from tracing and printing things itself. However, that is a larger project for the future.

This switches to using the tracing crate instead of log. Tracing
provides a lot of nice features which we can take advantage of moving
forward.

This also adjusts the output fairly significantly. This includes:

- Switched the environment variable from RUST_LOG to MDBOOK_LOG.
- Dropped the timestamp. I experimented with various different time
  displays, but ultimately decided to omit it for now. I don't think
  I've ever found it to be useful, and it takes up a very significant
  amount of space. It could potentially be useful for basic profiling,
  but I think there are other, better mechanisms for that. We could
  consider leveraging tracing itself for doing some basic profiling
  (like using something like tracing-chrome).
- Dropped the target unless MDBOOK_LOG is set. The target tends to be
  pretty noisy, and doesn't really convey much information unless you
  are debugging or otherwise trying to adjust the log output.
- Added color.
- Slightly reworked the way the error cause trace is displayed.
- Slightly changed the way html5ever filtering is done, as well as add
  handlebars to the list since they both are very noisy. You can
  override this now by explicitly listing them as targets.

I still expect that mdbook will eventually change how it displays things
to the console, possibly switching away from tracing and printing things
itself. However, that is a larger project for the future.
@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label Sep 12, 2025
@ehuss ehuss enabled auto-merge September 12, 2025 13:14
@ehuss ehuss added this pull request to the merge queue Sep 12, 2025
Merged via the queue into rust-lang:master with commit 8bb9a7f Sep 12, 2025
14 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: waiting on a review label Sep 12, 2025
ehuss added a commit to ehuss/mdBook that referenced this pull request Sep 15, 2025
I accidentally missed this in rust-lang#2829.
@ehuss ehuss mentioned this pull request Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants