10 releases (5 breaking)

0.6.0 Oct 30, 2024
0.5.0 Oct 30, 2024
0.4.0 Oct 30, 2024
0.3.0 Sep 11, 2024
0.1.2 Aug 31, 2024

#551 in Testing

Download history 227/week @ 2024-08-19 136/week @ 2024-08-26 20/week @ 2024-09-02 592/week @ 2024-09-09 52/week @ 2024-09-16 7/week @ 2024-09-23 18/week @ 2024-09-30 390/week @ 2024-10-28 5/week @ 2024-11-04

395 downloads per month

Apache-2.0

30KB
591 lines

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.

Dependencies

~7.5MB
~117K SLoC