8000 GitHub - intgr-forks/rust_testing_logger: A Rust library to support testing of code that uses Log crate.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

intgr-forks/rust_testing_logger

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!(
56B7
captured_logs.len(), 1);
        assert_eq!(captured_logs[0].body, "Something went wrong with 10");
        assert_eq!(captured_logs[0].level, Level::Warn);
    });
}

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%
0