#logging #call

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

#421 in Testing

Download history 9291/week @ 2024-12-14 3781/week @ 2024-12-21 4508/week @ 2024-12-28 8489/week @ 2025-01-04 9176/week @ 2025-01-11 8185/week @ 2025-01-18 9682/week @ 2025-01-25 13211/week @ 2025-02-01 13623/week @ 2025-02-08 11403/week @ 2025-02-15 13247/week @ 2025-02-22 10989/week @ 2025-03-01 11564/week @ 2025-03-08 13904/week @ 2025-03-15 15031/week @ 2025-03-22 10930/week @ 2025-03-29

53,058 downloads per month
Used in 26 crates (25 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

~90KB