rustlog 0.3.2

A small, dependency-light logging crate with a pragmatic API, color (optional), groups, and a scope timer
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
mod helpers; use helpers::*;
use rustlog::{info_group, scope_time};

#[test]
fn group_and_scope_timer_emit_lines() {
    let _g = test_lock().lock().unwrap();
    let (buf, _guard) = attach_mem_sink();
    reset_runtime();

    info_group!("net", "retry {}", 3);
    scope_time!("startup", { std::thread::sleep(std::time::Duration::from_millis(2)); });

    let lines = lines_from(&buf);
    assert!(lines.iter().any(|l| l.contains("[net]") && l.ends_with("retry 3")));
    assert!(lines.iter().any(|l| l.contains("[startup]") && l.contains("took ")));
}