Conversation
davidbarsky
left a comment
There was a problem hiding this comment.
I added some grammatical fixes, but naively, I think that these examples would be better placed on reload with the docs here linking to those?
| &self.subscriber | ||
| } | ||
|
|
||
| /// Mutably borrows the underlying [`Subscribe`] that is being filtered. |
There was a problem hiding this comment.
| /// Mutably borrows the underlying [`Subscribe`] that is being filtered. | |
| /// Returns a mutable borrow to the wrapped [`Subscribe`]. |
There was a problem hiding this comment.
@davidbarsky I just copied the wording from filter_mut. I agree that it could be more natural, but went for consistency.
There was a problem hiding this comment.
how about:
| /// Mutably borrows the underlying [`Subscribe`] that is being filtered. | |
| /// Mutably borrows the inner [subscriber] wrapped by this `Filtered` subscriber. | |
| /// | |
| /// [subscriber]: Subscribe |
| &mut self.filter | ||
| } | ||
|
|
||
| /// Borrows the underlying [`Subscribe`] that is being filtered. |
There was a problem hiding this comment.
| /// Borrows the underlying [`Subscribe`] that is being filtered. | |
| /// Returns a borrow to the wrapped [`Subscribe`]. |
There was a problem hiding this comment.
personally I prefer "Borrows" over "Returns a borrow to", but I agree that "that is being filtered" is awkward. How about
| /// Borrows the underlying [`Subscribe`] that is being filtered. | |
| /// Borrows the inner [subscriber] wrapped by this `Filtered` subscriber. | |
| /// | |
| /// [subscriber]: Subscribe |
| /// When this subscriber can be mutably borrowed, this may be used to mutate the underlying | ||
| /// subsrcribe. Generally, this will primarily be used with the | ||
| /// [`reload::Handle::modify`](crate::reload::Handle::modify) method. | ||
| /// | ||
| /// # Examples |
There was a problem hiding this comment.
| /// When this subscriber can be mutably borrowed, this may be used to mutate the underlying | |
| /// subsrcribe. Generally, this will primarily be used with the | |
| /// [`reload::Handle::modify`](crate::reload::Handle::modify) method. | |
| /// | |
| /// # Examples | |
| /// This method is primarily expected to be used with the | |
| /// [`reload::Handle::modify`](crate::reload::Handle::modify) method. For example: | |
| /// |
2d5d3e5 to
097b448
Compare
hawkw
left a comment
There was a problem hiding this comment.
Some documentation and naming suggestions, let me know what you think!
| &mut self.filter | ||
| } | ||
|
|
||
| /// Borrows the underlying [`Subscribe`] that is being filtered. |
There was a problem hiding this comment.
personally I prefer "Borrows" over "Returns a borrow to", but I agree that "that is being filtered" is awkward. How about
| /// Borrows the underlying [`Subscribe`] that is being filtered. | |
| /// Borrows the inner [subscriber] wrapped by this `Filtered` subscriber. | |
| /// | |
| /// [subscriber]: Subscribe |
| } | ||
|
|
||
| /// Borrows the underlying [`Subscribe`] that is being filtered. | ||
| pub fn wrapped(&self) -> &S { |
There was a problem hiding this comment.
Personally, I really don't love the name wrapped; I would probably call this either inner (for consistency with std, which tends to call the type wrapped by a wrapper type inner and has methods like inner_mut(), into_inner(), etc), or subscriber (the most descriptive IMO, also the name of the field). WDYT?
cc @davidbarsky
There was a problem hiding this comment.
Yeah, I think inner is a better option.
| /// info!("This will be logged to stdout"); | ||
| /// # } | ||
| /// ``` | ||
| pub fn wrapped_mut(&mut self) -> &mut S { |
There was a problem hiding this comment.
again, I would probably call this inner_mut or subscriber_mut...
| /// Mutably borrows the underlying [`Subscribe`] that is being filtered. | ||
| /// | ||
| /// When this subscriber can be mutably borrowed, this may be used to mutate the underlying | ||
| /// subsrcribe. Generally, this will primarily be used with the |
There was a problem hiding this comment.
| /// subsrcribe. Generally, this will primarily be used with the | |
| /// subscriber. Generally, this will primarily be used with the |
| &self.subscriber | ||
| } | ||
|
|
||
| /// Mutably borrows the underlying [`Subscribe`] that is being filtered. |
There was a problem hiding this comment.
how about:
| /// Mutably borrows the underlying [`Subscribe`] that is being filtered. | |
| /// Mutably borrows the inner [subscriber] wrapped by this `Filtered` subscriber. | |
| /// | |
| /// [subscriber]: Subscribe |
5d53aaf to
449308f
Compare
fdefd21 to
71d55ce
Compare
hawkw
left a comment
There was a problem hiding this comment.
one last suggestion for the documentation
3923b8f to
dc374df
Compare
* Filtered::inner * Filtered::inner_mut * format::Subscriber::writer * format::Subscriber::writer_mut * format::Subscriber::set_ansi
dc374df to
9882b08
Compare
hawkw
left a comment
There was a problem hiding this comment.
looks good to me --- @davidbarsky wanna give the docs a last look?
|
@wagenet btw, you don't need to force-push changes to your branches, we'll squash the entire branch prior to merging anyway, so it's fine to make a series of messy work-in-progress commits: https://github.com/tokio-rs/tracing/blob/master/CONTRIBUTING.md#commit-squashing |
|
@hawkw thanks for letting me know. I'd missed that. |
This adds more modification methods for use with reloading. Replaces #2032. ## Motivation I have a `Filtered` layer that I'd like to modify with a reload handle. If I use `reload` then the filter doesn't work. If I use `modify` with `filter_mut` I can't update the writer. ## Solution Adds some additional accessor methods to allow the writer to be modified in `modify`: * `Filtered::inner` * `Filtered::inner_mut` * `fmt::Layer::writer` * `fmt::Layer::writer_mut` * `fmt::Layer::set_ansi`
This adds more modification methods for use with reloading. Replaces #2032. ## Motivation I have a `Filtered` layer that I'd like to modify with a reload handle. If I use `reload` then the filter doesn't work. If I use `modify` with `filter_mut` I can't update the writer. ## Solution Adds some additional accessor methods to allow the writer to be modified in `modify`: * `Filtered::inner` * `Filtered::inner_mut` * `fmt::Layer::writer` * `fmt::Layer::writer_mut` * `fmt::Layer::set_ansi`
This adds more modification methods for use with reloading. Replaces #2032. ## Motivation I have a `Filtered` layer that I'd like to modify with a reload handle. If I use `reload` then the filter doesn't work. If I use `modify` with `filter_mut` I can't update the writer. ## Solution Adds some additional accessor methods to allow the writer to be modified in `modify`: * `Filtered::inner` * `Filtered::inner_mut` * `fmt::Layer::writer` * `fmt::Layer::writer_mut` * `fmt::Layer::set_ansi`
This adds more modification methods for use with reloading. Replaces #2032. ## Motivation I have a `Filtered` layer that I'd like to modify with a reload handle. If I use `reload` then the filter doesn't work. If I use `modify` with `filter_mut` I can't update the writer. ## Solution Adds some additional accessor methods to allow the writer to be modified in `modify`: * `Filtered::inner` * `Filtered::inner_mut` * `fmt::Layer::writer` * `fmt::Layer::writer_mut` * `fmt::Layer::set_ansi`
# 0.3.10 (Apr 1, 2022) This release adds several new features, including a `Filter` implementation and new builder API for `EnvFilter`, support for using a `Vec<L> where L: Layer` as a `Layer`, and a number of smaller API improvements to make working with dynamic and reloadable layers easier. ### Added - **registry**: Implement `Filter` for `EnvFilter`, allowing it to be used with per-layer filtering ([#1983]) - **registry**: `Filter::on_new_span`, `Filter::on_enter`, `Filter::on_exit`, `Filter::on_close` and `Filter::on_record` callbacks to allow `Filter`s to track span states internally ([#1973], [#2017], [#2031]) - **registry**: `Filtered::filter` and `Filtered::filter_mut` accessors ([#1959]) - **registry**: `Filtered::inner` and `Filtered::inner_mut` accessors to borrow the wrapped `Layer` ([#2034]) - **layer**: Implement `Layer` for `Vec<L: Layer>`, to allow composing together a dynamically sized list of `Layer`s ([#2027]) - **layer**: `Layer::boxed` method to make type-erasing `Layer`s easier ([#2026]) - **fmt**: `fmt::Layer::writer` and `fmt::Layer::writer_mut` accessors ([#2034]) - **fmt**: `fmt::Layer::set_ansi` method to allow changing the ANSI formatting configuration at runtime ([#2034]) - **env-filter**: `EnvFilter::builder` to configure a new `EnvFilter` prior to parsing it ([#2035]) - Several documentation fixes and improvements ([#1972], [#1971], [#2023], [#2023]) ### Fixed - **fmt**: `fmt::Layer`'s auto traits no longer depend on the `Subscriber` type parameter's auto traits ([2025]) - **env-filter**: Fixed missing help text when the `ansi` feature is disabled ([#2029]) Thanks to new contributors @TimoFreiberg and @wagenet, as well as @CAD97 for contributing to this release! [#1983]: #1983 [#1973]: #1973 [#2017]: #2017 [#2031]: #2031 [#1959]: #1959 [#2034]: #2034 [#2027]: #2027 [#2026]: #2026 [#2035]: #2035 [#1972]: #1972 [#1971]: #1971 [#2023]: #2023
# 0.3.10 (Apr 1, 2022) This release adds several new features, including a `Filter` implementation and new builder API for `EnvFilter`, support for using a `Vec<L> where L: Layer` as a `Layer`, and a number of smaller API improvements to make working with dynamic and reloadable layers easier. ### Added - **registry**: Implement `Filter` for `EnvFilter`, allowing it to be used with per-layer filtering ([#1983]) - **registry**: `Filter::on_new_span`, `Filter::on_enter`, `Filter::on_exit`, `Filter::on_close` and `Filter::on_record` callbacks to allow `Filter`s to track span states internally ([#1973], [#2017], [#2031]) - **registry**: `Filtered::filter` and `Filtered::filter_mut` accessors ([#1959]) - **registry**: `Filtered::inner` and `Filtered::inner_mut` accessors to borrow the wrapped `Layer` ([#2034]) - **layer**: Implement `Layer` for `Vec<L: Layer>`, to allow composing together a dynamically sized list of `Layer`s ([#2027]) - **layer**: `Layer::boxed` method to make type-erasing `Layer`s easier ([#2026]) - **fmt**: `fmt::Layer::writer` and `fmt::Layer::writer_mut` accessors ([#2034]) - **fmt**: `fmt::Layer::set_ansi` method to allow changing the ANSI formatting configuration at runtime ([#2034]) - **env-filter**: `EnvFilter::builder` to configure a new `EnvFilter` prior to parsing it ([#2035]) - Several documentation fixes and improvements ([#1972], [#1971], [#2023], [#2023]) ### Fixed - **fmt**: `fmt::Layer`'s auto traits no longer depend on the `Subscriber` type parameter's auto traits ([2025]) - **env-filter**: Fixed missing help text when the `ansi` feature is disabled ([#2029]) Thanks to new contributors @TimoFreiberg and @wagenet, as well as @CAD97 for contributing to this release! [#1983]: #1983 [#1973]: #1973 [#2017]: #2017 [#2031]: #2031 [#1959]: #1959 [#2034]: #2034 [#2027]: #2027 [#2026]: #2026 [#2035]: #2035 [#1972]: #1972 [#1971]: #1971 [#2023]: #2023
# 0.3.10 (Apr 1, 2022) This release adds several new features, including a `Filter` implementation and new builder API for `EnvFilter`, support for using a `Vec<L> where L: Layer` as a `Layer`, and a number of smaller API improvements to make working with dynamic and reloadable layers easier. ### Added - **registry**: Implement `Filter` for `EnvFilter`, allowing it to be used with per-layer filtering ([#1983]) - **registry**: `Filter::on_new_span`, `Filter::on_enter`, `Filter::on_exit`, `Filter::on_close` and `Filter::on_record` callbacks to allow `Filter`s to track span states internally ([#1973], [#2017], [#2031]) - **registry**: `Filtered::filter` and `Filtered::filter_mut` accessors ([#1959]) - **registry**: `Filtered::inner` and `Filtered::inner_mut` accessors to borrow the wrapped `Layer` ([#2034]) - **layer**: Implement `Layer` for `Vec<L: Layer>`, to allow composing together a dynamically sized list of `Layer`s ([#2027]) - **layer**: `Layer::boxed` method to make type-erasing `Layer`s easier ([#2026]) - **fmt**: `fmt::Layer::writer` and `fmt::Layer::writer_mut` accessors ([#2034]) - **fmt**: `fmt::Layer::set_ansi` method to allow changing the ANSI formatting configuration at runtime ([#2034]) - **env-filter**: `EnvFilter::builder` to configure a new `EnvFilter` prior to parsing it ([#2035]) - Several documentation fixes and improvements ([#1972], [#1971], [#2023], [#2023]) ### Fixed - **fmt**: `fmt::Layer`'s auto traits no longer depend on the `Subscriber` type parameter's auto traits ([2025]) - **env-filter**: Fixed missing help text when the `ansi` feature is disabled ([#2029]) Thanks to new contributors @TimoFreiberg and @wagenet, as well as @CAD97 for contributing to this release! [#1983]: #1983 [#1973]: #1973 [#2017]: #2017 [#2031]: #2031 [#1959]: #1959 [#2034]: #2034 [#2027]: #2027 [#2026]: #2026 [#2035]: #2035 [#1972]: #1972 [#1971]: #1971 [#2023]: #2023
# 0.3.10 (Apr 1, 2022) This release adds several new features, including a `Filter` implementation and new builder API for `EnvFilter`, support for using a `Vec<L> where L: Layer` as a `Layer`, and a number of smaller API improvements to make working with dynamic and reloadable layers easier. ### Added - **registry**: Implement `Filter` for `EnvFilter`, allowing it to be used with per-layer filtering ([#1983]) - **registry**: `Filter::on_new_span`, `Filter::on_enter`, `Filter::on_exit`, `Filter::on_close` and `Filter::on_record` callbacks to allow `Filter`s to track span states internally ([#1973], [#2017], [#2031]) - **registry**: `Filtered::filter` and `Filtered::filter_mut` accessors ([#1959]) - **registry**: `Filtered::inner` and `Filtered::inner_mut` accessors to borrow the wrapped `Layer` ([#2034]) - **layer**: Implement `Layer` for `Vec<L: Layer>`, to allow composing together a dynamically sized list of `Layer`s ([#2027]) - **layer**: `Layer::boxed` method to make type-erasing `Layer`s easier ([#2026]) - **fmt**: `fmt::Layer::writer` and `fmt::Layer::writer_mut` accessors ([#2034]) - **fmt**: `fmt::Layer::set_ansi` method to allow changing the ANSI formatting configuration at runtime ([#2034]) - **env-filter**: `EnvFilter::builder` to configure a new `EnvFilter` prior to parsing it ([#2035]) - Several documentation fixes and improvements ([#1972], [#1971], [#2023], [#2023]) ### Fixed - **fmt**: `fmt::Layer`'s auto traits no longer depend on the `Subscriber` type parameter's auto traits ([2025]) - **env-filter**: Fixed missing help text when the `ansi` feature is disabled ([#2029]) Thanks to new contributors @TimoFreiberg and @wagenet, as well as @CAD97 for contributing to this release! [#1983]: #1983 [#1973]: #1973 [#2017]: #2017 [#2031]: #2031 [#1959]: #1959 [#2034]: #2034 [#2027]: #2027 [#2026]: #2026 [#2035]: #2035 [#1972]: #1972 [#1971]: #1971 [#2023]: #2023
# 0.3.10 (Apr 1, 2022) This release adds several new features, including a `Filter` implementation and new builder API for `EnvFilter`, support for using a `Vec<L> where L: Layer` as a `Layer`, and a number of smaller API improvements to make working with dynamic and reloadable layers easier. ### Added - **registry**: Implement `Filter` for `EnvFilter`, allowing it to be used with per-layer filtering ([#1983]) - **registry**: `Filter::on_new_span`, `Filter::on_enter`, `Filter::on_exit`, `Filter::on_close` and `Filter::on_record` callbacks to allow `Filter`s to track span states internally ([#1973], [#2017], [#2031]) - **registry**: `Filtered::filter` and `Filtered::filter_mut` accessors ([#1959]) - **registry**: `Filtered::inner` and `Filtered::inner_mut` accessors to borrow the wrapped `Layer` ([#2034]) - **layer**: Implement `Layer` for `Vec<L: Layer>`, to allow composing together a dynamically sized list of `Layer`s ([#2027]) - **layer**: `Layer::boxed` method to make type-erasing `Layer`s easier ([#2026]) - **fmt**: `fmt::Layer::writer` and `fmt::Layer::writer_mut` accessors ([#2034]) - **fmt**: `fmt::Layer::set_ansi` method to allow changing the ANSI formatting configuration at runtime ([#2034]) - **env-filter**: `EnvFilter::builder` to configure a new `EnvFilter` prior to parsing it ([#2035]) - Several documentation fixes and improvements ([#1972], [#1971], [#2023], [#2023]) ### Fixed - **fmt**: `fmt::Layer`'s auto traits no longer depend on the `Subscriber` type parameter's auto traits ([#2025]) - **env-filter**: Fixed missing help text when the `ansi` feature is disabled ([#2029]) Thanks to new contributors @TimoFreiberg and @wagenet, as well as @CAD97 for contributing to this release! [#1983]: #1983 [#1973]: #1973 [#2017]: #2017 [#2031]: #2031 [#1959]: #1959 [#2034]: #2034 [#2027]: #2027 [#2026]: #2026 [#2035]: #2035 [#1972]: #1972 [#1971]: #1971 [#2023]: #2023 [#2025]: #2025 [#2029]: #2029
This adds more modification methods for use with reloading. Replaces tokio-rs#2032. ## Motivation I have a `Filtered` layer that I'd like to modify with a reload handle. If I use `reload` then the filter doesn't work. If I use `modify` with `filter_mut` I can't update the writer. ## Solution Adds some additional accessor methods to allow the writer to be modified in `modify`: * `Filtered::inner` * `Filtered::inner_mut` * `fmt::Layer::writer` * `fmt::Layer::writer_mut` * `fmt::Layer::set_ansi`
# 0.3.10 (Apr 1, 2022) This release adds several new features, including a `Filter` implementation and new builder API for `EnvFilter`, support for using a `Vec<L> where L: Layer` as a `Layer`, and a number of smaller API improvements to make working with dynamic and reloadable layers easier. ### Added - **registry**: Implement `Filter` for `EnvFilter`, allowing it to be used with per-layer filtering ([tokio-rs#1983]) - **registry**: `Filter::on_new_span`, `Filter::on_enter`, `Filter::on_exit`, `Filter::on_close` and `Filter::on_record` callbacks to allow `Filter`s to track span states internally ([tokio-rs#1973], [tokio-rs#2017], [tokio-rs#2031]) - **registry**: `Filtered::filter` and `Filtered::filter_mut` accessors ([tokio-rs#1959]) - **registry**: `Filtered::inner` and `Filtered::inner_mut` accessors to borrow the wrapped `Layer` ([tokio-rs#2034]) - **layer**: Implement `Layer` for `Vec<L: Layer>`, to allow composing together a dynamically sized list of `Layer`s ([tokio-rs#2027]) - **layer**: `Layer::boxed` method to make type-erasing `Layer`s easier ([tokio-rs#2026]) - **fmt**: `fmt::Layer::writer` and `fmt::Layer::writer_mut` accessors ([tokio-rs#2034]) - **fmt**: `fmt::Layer::set_ansi` method to allow changing the ANSI formatting configuration at runtime ([tokio-rs#2034]) - **env-filter**: `EnvFilter::builder` to configure a new `EnvFilter` prior to parsing it ([tokio-rs#2035]) - Several documentation fixes and improvements ([tokio-rs#1972], [tokio-rs#1971], [tokio-rs#2023], [tokio-rs#2023]) ### Fixed - **fmt**: `fmt::Layer`'s auto traits no longer depend on the `Subscriber` type parameter's auto traits ([tokio-rs#2025]) - **env-filter**: Fixed missing help text when the `ansi` feature is disabled ([tokio-rs#2029]) Thanks to new contributors @TimoFreiberg and @wagenet, as well as @CAD97 for contributing to this release! [tokio-rs#1983]: tokio-rs#1983 [tokio-rs#1973]: tokio-rs#1973 [tokio-rs#2017]: tokio-rs#2017 [tokio-rs#2031]: tokio-rs#2031 [tokio-rs#1959]: tokio-rs#1959 [tokio-rs#2034]: tokio-rs#2034 [tokio-rs#2027]: tokio-rs#2027 [tokio-rs#2026]: tokio-rs#2026 [tokio-rs#2035]: tokio-rs#2035 [tokio-rs#1972]: tokio-rs#1972 [tokio-rs#1971]: tokio-rs#1971 [tokio-rs#2023]: tokio-rs#2023 [tokio-rs#2025]: tokio-rs#2025 [tokio-rs#2029]: tokio-rs#2029
This adds more modification methods for use with reloading. Replaces #2032.
Needs fixes in doc tests.
Motivation
I have a Filtered layer that I'd like to modify with a reload handle. If I use
reloadthen the filter doesn't work. If I usemodifywithfilter_mutI can't update the writer.Solution
Adds some additional accessor methods to allow the writer to be modified in
modify.