-
Notifications
You must be signed in to change notification settings - Fork 721
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
subscriber: fix issue with EnvFilter::builder().parse
#2052
Conversation
I'm pretty sure this works correctly, but I had trouble testing it with my own applications because of reasons unrelated to these changes. Maybe, you as maintainers, encountered this when testing your changes: tracing-subscriber = { version = "0.3.10", features = ["env-filter"] }
tracing-subscriber = { git = "https://github.com/tokio-rs/tracing.git", tag = "tracing-subscriber-0.3.10", features = ["env-filter"] } When I have the first line in my |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks good to me!
Because the |
…#2052) ## Motivation See issue #2046. When using calling [`Builder::parse`] or [`Builder::parse_lossy`] with an empty string an error is produced. This happens for example when `EnvFilter::from_default_env()` is called, but the `RUST_LOG` variable is unset. This regression was introduced by #2035. ## Solution Filter any empty directives. This allows the whole string to be empty, as well as leading and trailing commas. A unit test was added for [`Builder::parse`], but not [`Builder::parse_lossy`] because it (per definition) doesn't produce any side effects visible from tests when erroring. Fixes #2046 [`Builder::parse`]: https://github.com/tokio-rs/tracing/blob/cade7e311848227348c9b3062e4a33db827a0390/tracing-subscriber/src/filter/env/builder.rs#L151= [`Builder::parse_lossy`]: https://github.com/tokio-rs/tracing/blob/cade7e311848227348c9b3062e4a33db827a0390/tracing-subscriber/src/filter/env/builder.rs#L135=
…#2052) ## Motivation See issue #2046. When using calling [`Builder::parse`] or [`Builder::parse_lossy`] with an empty string an error is produced. This happens for example when `EnvFilter::from_default_env()` is called, but the `RUST_LOG` variable is unset. This regression was introduced by #2035. ## Solution Filter any empty directives. This allows the whole string to be empty, as well as leading and trailing commas. A unit test was added for [`Builder::parse`], but not [`Builder::parse_lossy`] because it (per definition) doesn't produce any side effects visible from tests when erroring. Fixes #2046 [`Builder::parse`]: https://github.com/tokio-rs/tracing/blob/cade7e311848227348c9b3062e4a33db827a0390/tracing-subscriber/src/filter/env/builder.rs#L151= [`Builder::parse_lossy`]: https://github.com/tokio-rs/tracing/blob/cade7e311848227348c9b3062e4a33db827a0390/tracing-subscriber/src/filter/env/builder.rs#L135=
# 0.3.11 (Apr 9, 2022) This is a bugfix release for the `Filter` implementation for `EnvFilter` added in [v0.3.10]. ### Fixed - **env-filter**: Added missing `Filter::on_record` callback to `EnvFilter`'s `Filter` impl ([#2058]) - **env-filter**: Fixed method resolution issues when calling `EnvFilter` methods with both the `Filter` and `Layer` traits in scope ([#2057]) - **env-filter**: Fixed `EnvFilter::builder().parse()` and other parsing methods returning an error when parsing an empty string ([#2052]) Thanks to new contributor @Ma124 for contributing to this release! [v0.3.10]: https://github.com/tokio-rs/tracing/releases/tag/tracing-subscriber-0.3.10 [#2058]: #2058 [#2057]: #2057 [#2052]: #2052
# 0.3.11 (Apr 9, 2022) This is a bugfix release for the `Filter` implementation for `EnvFilter` added in [v0.3.10]. ### Fixed - **env-filter**: Added missing `Filter::on_record` callback to `EnvFilter`'s `Filter` impl ([#2058]) - **env-filter**: Fixed method resolution issues when calling `EnvFilter` methods with both the `Filter` and `Layer` traits in scope ([#2057]) - **env-filter**: Fixed `EnvFilter::builder().parse()` and other parsing methods returning an error when parsing an empty string ([#2052]) Thanks to new contributor @Ma124 for contributing to this release! [v0.3.10]: https://github.com/tokio-rs/tracing/releases/tag/tracing-subscriber-0.3.10 [#2058]: #2058 [#2057]: #2057 [#2052]: #2052
# 0.3.11 (Apr 9, 2022) This is a bugfix release for the `Filter` implementation for `EnvFilter` added in [v0.3.10]. ### Fixed - **env-filter**: Added missing `Filter::on_record` callback to `EnvFilter`'s `Filter` impl ([tokio-rs#2058]) - **env-filter**: Fixed method resolution issues when calling `EnvFilter` methods with both the `Filter` and `Layer` traits in scope ([tokio-rs#2057]) - **env-filter**: Fixed `EnvFilter::builder().parse()` and other parsing methods returning an error when parsing an empty string ([tokio-rs#2052]) Thanks to new contributor @Ma124 for contributing to this release! [v0.3.10]: https://github.com/tokio-rs/tracing/releases/tag/tracing-subscriber-0.3.10 [tokio-rs#2058]: tokio-rs#2058 [tokio-rs#2057]: tokio-rs#2057 [tokio-rs#2052]: tokio-rs#2052
Motivation
See issue #2046.
When using calling
Builder::parse
orBuilder::parse_lossy
with an emptystring an error is produced. This happens for example when
EnvFilter::from_default_env()
is called, but the
RUST_LOG
variable is unset.This regression was introduced by #2035.
Solution
Filter any empty directives. This allows the whole string to be empty, as well as leading
and trailing commas.
A unit test was added for
Builder::parse
, but notBuilder::parse_lossy
because it (per definition)doesn't produce any side effects visible from tests when erroring.