#logging #log #log-level #validation

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

#303 in Testing

Download history 9973/week @ 2024-07-21 10438/week @ 2024-07-28 9684/week @ 2024-08-04 11328/week @ 2024-08-11 11900/week @ 2024-08-18 11360/week @ 2024-08-25 10690/week @ 2024-09-01 13161/week @ 2024-09-08 11493/week @ 2024-09-15 12001/week @ 2024-09-22 10823/week @ 2024-09-29 11954/week @ 2024-10-06 11027/week @ 2024-10-13 13659/week @ 2024-10-20 10380/week @ 2024-10-27 9628/week @ 2024-11-03

45,146 downloads per month
Used in 21 crates (20 directly)

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

~87KB