New crate: tao-log, a std::dbg! superset for log

  • Find std::dbg! useful, but also have log setup? Want output directed to the same logging system, with the same format and configurable features?

  • Want to be able to keep debug and trace level logging in place, even in release builds?

  • Annoyed by the inconsistent cargo test output capture, which doesn’t capture non-test threads and most logging implementations?

I first wrote a log crate RFC 317: Inline Expression and Value Logging which explains the motivation and design in much more detail. The feature might eventually land in log itself, but tao-log is published and available now. Synopsis:

use std::time::{Duration, Instant};
use tao_log::*;

let remaining = debugv!(deadline - Instant::now());
//              ^-- debug log message: deadline - Instant::now() → 950µs

// Or, alternatively:
debugv!("time until deadline", remaining);
//              ^-- debug log message: time until deadline remaining → 950µs