#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

#316 in Testing

Download history 11868/week @ 2024-08-21 9925/week @ 2024-08-28 12880/week @ 2024-09-04 12445/week @ 2024-09-11 11063/week @ 2024-09-18 11892/week @ 2024-09-25 10983/week @ 2024-10-02 12516/week @ 2024-10-09 11481/week @ 2024-10-16 12896/week @ 2024-10-23 9868/week @ 2024-10-30 8632/week @ 2024-11-06 10500/week @ 2024-11-13 10985/week @ 2024-11-20 8266/week @ 2024-11-27 7702/week @ 2024-12-04

39,159 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

~86KB