-
-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(subscriber): use per-layer filtering
Currently, the `console_subscriber::build()` and `console_subscriber::init()` functions configure an `EnvFilter` that enables the `tokio` and `runtime` targets, plus any targets configured by `RUST_LOG`. This means that the `tokio` spans used by the console will always be enabled at the `TRACE` level for all layers. This includes the `fmt` layer we previously added in `init`. Since this resulted in the `fmt` layer logs being cluttered with a bunch of `tokio=trace` spans and events even when only high-level application logs are enabled by `RUST_LOG`, we removed the `fmt` layer in PR #64. However, tokio-rs/tracing#1523 was recently merged and [released][1], adding support for [per-layer filtering][2] to `tracing-subscriber`. We can now use the per-layer filtering API to selectively enable the `tokio`/`runtime` spans and events at the `TRACE` level _only_ for the `TasksLayer`, and add a filter to the `fmt` layer based on `RUST_LOG`. This allows us to put back the `fmt` layer in `console_subscriber::init`. Closes #76
- Loading branch information
Showing
4 changed files
with
68 additions
and
19 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters