-
Notifications
You must be signed in to change notification settings - Fork 731
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
Move tracing-subscriber test/support module into tracing-mock #2359
Comments
hds
added a commit
that referenced
this issue
Nov 4, 2022
The `tracing-subscriber` module `tests::support` included functionality to mock a subscriber (via the `Subscribe` trait). This code depends on some items from `tracing_mock::collector` which should otherwise not be public. This change moves the mocking functionality inside `tracing-mock` behind a feature flag. Allowing the `Expect` enum and `MockHandle::new` from `tracing_mock::collector` to be made `pub(crate)` instead of `pub`. Since it's now used from two different modules, the `Expect` enum has been moved to its own module. This requires a lot of modifications to imports so that we're not doing wildcard imports from another crate (i.e. in `tracing-subscriber` importing wildcards from `tracing-mock`). Closes: #2359
hawkw
pushed a commit
that referenced
this issue
Nov 8, 2022
The `tracing-subscriber` module `tests::support` included functionality to mock a subscriber (via the `Subscribe` trait). This code depends on some items from `tracing_mock::collector` which should otherwise not be public. This change moves the mocking functionality inside `tracing-mock` behind a feature flag. Allowing the `Expect` enum and `MockHandle::new` from `tracing_mock::collector` to be made `pub(crate)` instead of `pub`. Since it's now used from two different modules, the `Expect` enum has been moved to its own module. This requires a lot of modifications to imports so that we're not doing wildcard imports from another crate (i.e. in `tracing-subscriber` importing wildcards from `tracing-mock`). Closes: #2359
hawkw
added a commit
that referenced
this issue
Apr 21, 2023
The `tracing-subscriber` module `tests::support` included functionality to mock a subscriber (via the `Subscribe` trait). This code depends on some items from `tracing_mock::collector` which should otherwise not be public. This change moves the mocking functionality inside `tracing-mock` behind a feature flag. Allowing the `Expect` enum and `MockHandle::new` from `tracing_mock::collector` to be made `pub(crate)` instead of `pub`. Since it's now used from two different modules, the `Expect` enum has been moved to its own module. This requires a lot of modifications to imports so that we're not doing wildcard imports from another crate (i.e. in `tracing-subscriber` importing wildcards from `tracing-mock`). Closes: #2359
hawkw
added a commit
that referenced
this issue
Apr 21, 2023
The `tracing-subscriber` module `tests::support` included functionality to mock a layer (via the `Layer` trait). This code depends on some items from `tracing_mock::collector` which should otherwise not be public. This change moves the mocking functionality inside `tracing-mock` behind a feature flag. Allowing the `Expect` enum and `MockHandle::new` from `tracing_mock::collector` to be made `pub(crate)` instead of `pub`. Since it's now used from two different modules, the `Expect` enum has been moved to its own module. This requires a lot of modifications to imports so that we're not doing wildcard imports from another crate (i.e. in `tracing-subscriber` importing wildcards from `tracing-mock`). This PR is based on @hds' PR #2369, but modified to track renamings. I also deleted all the doc comments temporarily because updating them was a lot of work and I need to get a release of `tracing-subscriber` out first. Closes: #2359
hawkw
added a commit
that referenced
this issue
Apr 21, 2023
The `tracing-subscriber` module `tests::support` included functionality to mock a layer (via the `Layer` trait). This code depends on some items from `tracing_mock::collector` which should otherwise not be public. This change moves the mocking functionality inside `tracing-mock` behind a feature flag. Allowing the `Expect` enum and `MockHandle::new` from `tracing_mock::collector` to be made `pub(crate)` instead of `pub`. Since it's now used from two different modules, the `Expect` enum has been moved to its own module. This requires a lot of modifications to imports so that we're not doing wildcard imports from another crate (i.e. in `tracing-subscriber` importing wildcards from `tracing-mock`). This PR is based on @hds' PR #2369, but modified to track renamings. I also deleted all the doc comments temporarily because updating them was a lot of work and I need to get a release of `tracing-subscriber` out first. Closes: #2359
kaffarell
pushed a commit
to kaffarell/tracing
that referenced
this issue
May 22, 2024
The `tracing-subscriber` module `tests::support` included functionality to mock a layer (via the `Layer` trait). This code depends on some items from `tracing_mock::collector` which should otherwise not be public. This change moves the mocking functionality inside `tracing-mock` behind a feature flag. Allowing the `Expect` enum and `MockHandle::new` from `tracing_mock::collector` to be made `pub(crate)` instead of `pub`. Since it's now used from two different modules, the `Expect` enum has been moved to its own module. This requires a lot of modifications to imports so that we're not doing wildcard imports from another crate (i.e. in `tracing-subscriber` importing wildcards from `tracing-mock`). This PR is based on @hds' PR tokio-rs#2369, but modified to track renamings. I also deleted all the doc comments temporarily because updating them was a lot of work and I need to get a release of `tracing-subscriber` out first. Closes: tokio-rs#2359
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature Request
Refactor
tracing-subscriber::tests::support
andtracing-mock
so that some items currently defined as public intracing-mock
can be made not-public (specificallypub(crate)
).Crates
tracing-subscriber
tracing-mock
Motivation
While documenting
tracing-mock
, I found a couple of things in thecollector
module which are public, but don't need to be except that they're used in the moduletracing-subscriber::tests::support
.In the context of #539, this is potentially exposing parts of
tracing-mock
that it would be better not to expose. For example the numcollector::Expect
is currenlty public, leaving it this way would make adding new expectations a breaking change.Proposal
Move everything needed by
tracing-subscriber
tests (that uses potentialtracing-mock
internals) intotracing-mock
itself and put it behind a feature flag.Alternatives
Another solution would be to duplicate the required parts of
tracing-mock
in thesupport
module - which I think is how it was set up before.Or these public items could be reworked to ensure forward comaptibility, for example by adding
#[non_exhaustive]
to the previously mentionedExpect
enum.The text was updated successfully, but these errors were encountered: