tracing-assertions

Crates.iotracing-assertions
lib.rstracing-assertions
version
sourcesrc
created_at2024-08-24 02:08:18.624944
updated_at2024-10-30 20:11:08.171043
descriptionAn assertions framework for Tokio tracing.
homepage
repositoryhttps://github.com/JonathanWoollett-Light/tracing-assertions
max_upload_size
id1349769
Cargo.toml error:TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Jonathan Woollett-Light (JonathanWoollett-Light)

documentation

https://docs.rs/tracing-assertions/

README

tracing-assertions

Crates.io docs codecov

An assertions framework for tracing.

Simpler and faster than the alternatives.

use tracing_subscriber::layer::SubscriberExt;
// Initialize a subscriber with the layer.
let asserter = tracing_assertions::Layer::default();
let registry = tracing_subscriber::Registry::default();
let subscriber = registry.with(asserter.clone());
let guard = tracing::subscriber::set_default(subscriber);
let one = asserter.matches("one");
let two = asserter.matches("two");
let and = &one & &two;
tracing::info!("one");
one.assert();
tracing::info!("two");
two.assert();
and.assert();

drop(guard); // Drop `subscriber` as the current subscriber.

Similar crates

  • test-log: A replacement of the #[test] attribute that initializes logging and/or tracing infrastructure before running tests.
  • tracing_test: Helper functions and macros that allow for easier testing of crates that use tracing.
  • tracing-fluent-assertions: An fluent assertions framework for tracing.
Commit count: 17

cargo fmt