0.6.1
Key Changes
- Support better capturing for
cargo test
- Don't print internal logs to
stdout
Contributions
- @nlopes Fix path for rust-lang favicon
- @emilio Don't print to stdout the warnings due to an invalid spec
- Support capturing for cargo test
More Details
Builder::is_test
The is_test
method can be used in tests to make sure logs are captured by cargo test
the same way println!
is:
fn init() {
let _ = env_logger::builder().is_test(true).try_init();
}
#[test]
fn it_adds_one() {
init();
info!("can log from the test too");
assert_eq!(3, add_one(2));
}
There are performance implications of using is_test
though, so it should be avoided outside of unit tests.