testing_logger

A Rust library to support testing of code that uses log crate.

Version Documentation license Status

Example

```rust

[macro_use]

extern crate log; use log::Level; extern crate testing_logger;

[test]

fn testsomething() { testinglogger::setup(); warn!("Something went wrong with {}", 10); testinglogger::validate( |capturedlogs| { asserteq!(capturedlogs.len(), 1); asserteq!(capturedlogs[0].body, "Something went wrong with 10"); asserteq!(capturedlogs[0].level, Level::Warn); }); } ```