-
Notifications
You must be signed in to change notification settings - Fork 887
fix max_level_hint for empty cases for Option/Vec Subscribe impls #2195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
734bcd0
1043aab
219958b
4734d09
c9f6bb8
d3e9f6b
fbf8b40
291b25a
8a94118
8429efd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| mod support; | ||
| use self::support::*; | ||
| mod filter_scopes; | ||
| mod option; | ||
| mod targets; | ||
| mod trees; | ||
| mod vec; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| use super::*; | ||
| use tracing::Collect; | ||
|
|
||
| // This test is just used to compare to the tests below | ||
| #[test] | ||
| fn just_layer() { | ||
| let info = subscriber::named("info") | ||
| .run() | ||
| .with_filter(LevelFilter::INFO) | ||
| .boxed(); | ||
|
|
||
| let collector = tracing_subscriber::registry().with(info); | ||
| assert_eq!(collector.max_level_hint(), Some(LevelFilter::INFO)); | ||
| } | ||
|
|
||
| #[test] | ||
| fn layer_and_option_layer() { | ||
| let info = subscriber::named("info") | ||
| .run() | ||
| .with_filter(LevelFilter::INFO) | ||
| .boxed(); | ||
|
|
||
| let debug = subscriber::named("debug") | ||
| .run() | ||
| .with_filter(LevelFilter::DEBUG) | ||
| .boxed(); | ||
|
|
||
| let mut collector = tracing_subscriber::registry().with(info).with(Some(debug)); | ||
| assert_eq!(collector.max_level_hint(), Some(LevelFilter::DEBUG)); | ||
|
|
||
| let error = subscriber::named("error") | ||
| .run() | ||
| .with_filter(LevelFilter::ERROR) | ||
| .boxed(); | ||
| // None means the other layer takes control | ||
| collector = tracing_subscriber::registry().with(error).with(None); | ||
| assert_eq!(collector.max_level_hint(), Some(LevelFilter::ERROR)); | ||
guswynn marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| #[test] | ||
| fn just_option_layer() { | ||
guswynn marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // Just a None means everything is off | ||
| let collector = tracing_subscriber::registry().with(None::<ExpectSubscriber>); | ||
| assert_eq!(collector.max_level_hint(), Some(LevelFilter::OFF)); | ||
| } | ||
|
||
Uh oh!
There was an error while loading. Please reload this page.