Skip to content

Commit

Permalink
feat(subscriber): Add cfg console_without_tokio_unstable
Browse files Browse the repository at this point in the history
Add cfg `console_without_tokio_unstable` for developers to turn off the
assertion on `tokio_unstable`. This is useful for non-tokio runtimes
which has `tokio-console` support.
  • Loading branch information
ldm0 committed Jul 13, 2023
1 parent 7c8e80a commit 4c28842
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions console-subscriber/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ tracing_subscriber::registry()
[`tokio-console`]: https://github.com/tokio-rs/console
[Tokio]: https://tokio.rs

### Using other runtimes

If you are using a custom runtime that supports tokio-console, you may not need to enable "tokio_unstable". In this case, you need to enable cfg `console_without_tokio_unstable` for console-subscriber to disable its check for `tokio_unstable`.

### Crate Feature Flags

This crate provides the following feature flags and optional dependencies:
Expand Down
2 changes: 1 addition & 1 deletion console-subscriber/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ impl ConsoleLayer {
// depending on the build-time configuration...
#![allow(clippy::assertions_on_constants)]
assert!(
cfg!(tokio_unstable),
cfg!(any(tokio_unstable, console_without_tokio_unstable)),
"task tracing requires Tokio to be built with RUSTFLAGS=\"--cfg tokio_unstable\"!"
);

Expand Down

0 comments on commit 4c28842

Please sign in to comment.