
The `tracing-mock` crate provides a mock collector (and a subscriber for use by the tests in the `tracing-subscriber` crate) which is able to make assertions about what diagnostics are emitted. These assertions are defined by structs that match on events, span, and their fields and metadata. The structs that matched these objects have been called, up until now, mocks, however this terminology may be misleading, as the created objects don't mock anything. There were two different names for similar functionality with `only()` and `done()` on fields and collectors/subscribers respectively. Using a single name for these may make it easier to onboard onto `tracing-mock`. To reduce confusion, these structs have been split into two categories: mocks and expectations. Additionally, the `done()` function on the `Collector` and `Subscriber` mocks has been replaced with `only()`. This matches the similar function for `ExpectedField`, and may be more intuitive. The mocks replace some component in the tracing ecosystem when a library is under test. The expectations define the assertions we wish to make about traces received by the mocks. Mocks (per module): * collector - `MockCollector`, no change * subscriber - `MockSubscriber`, renamed from `ExpectSubscriber` Expectations (per module): * event - `ExpectedEvent`, renamed from `MockEvent` * span - `ExpectedSpan`, renamed from `MockSpan` * field - `ExpectedField` and `ExpectedFields`, renamed from `MockField` and `Expected`. Also `ExpectedValue` renamed from `MockValue`. * metadata - `ExpectedMetadata`, renamed from `Expected` Refs: #539
tracing-subscriber
Utilities for implementing and composing tracing
subscribers.
Compiler support: requires rustc
1.56+
Supported Rust Versions
Tracing is built against the latest stable release. The minimum supported version is 1.56. The current Tracing version is not guaranteed to build on Rust versions earlier than the minimum supported version.
Tracing follows the same compiler support policies as the rest of the Tokio project. The current stable Rust compiler and the three most recent minor versions before it will always be supported. For example, if the current stable compiler version is 1.69, the minimum supported version will not be increased past 1.66, three minor versions prior. Increasing the minimum supported compiler version is not considered a semver breaking change as long as doing so complies with this policy.
License
This project is licensed under the MIT license.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Tracing by you, shall be licensed as MIT, without any additional terms or conditions.