#testing #logging #log

dev testing_logger

Supports writing tests to verify log crate calls

2 releases

Uses old Rust 2015

0.1.1 Aug 7, 2018
0.1.0 Aug 7, 2018

#206 in Testing

Download history 115/week @ 2021-06-30 244/week @ 2021-07-07 217/week @ 2021-07-14 229/week @ 2021-07-21 165/week @ 2021-07-28 144/week @ 2021-08-04 179/week @ 2021-08-11 206/week @ 2021-08-18 188/week @ 2021-08-25 224/week @ 2021-09-01 214/week @ 2021-09-08 378/week @ 2021-09-15 198/week @ 2021-09-22 282/week @ 2021-09-29 178/week @ 2021-10-06 465/week @ 2021-10-13

1,297 downloads per month
Used in 5 crates

BSD-3-Clause

7KB

testing_logger

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

Version Documentation license Status

Example

#[macro_use]
extern crate log;
use log::Level;
extern crate testing_logger;

#[test]
fn test_something() {
    testing_logger::setup();
    warn!("Something went wrong with {}", 10);
    testing_logger::validate( |captured_logs| {
        assert_eq!(captured_logs.len(), 1);
        assert_eq!(captured_logs[0].body, "Something went wrong with 10");
        assert_eq!(captured_logs[0].level, Level::Warn);
    });
}

Dependencies

~81KB