zinzen 0.3.0

Algorithm for auto-scheduling time-constrained tasks on a timeline
//! Internal diagnostic logging.
//!
//! ADR-0004 (see `adr/0004-structured-logging-only.md`): this module is the
//! single allowlisted location that may call the standard output/error macros.
//! Everywhere else in `src/` must use [`log_debug!`] / [`log_dbg!`], which
//! compile to nothing unless the `with-logging` Cargo feature is enabled
//! (off by default, so the shipped WASM stays quiet and fast).

/// Print a formatted diagnostic line, only when the `with-logging` feature is
/// enabled. Usage mirrors [`println!`].
#[macro_export]
macro_rules! log_debug {
    ($($arg:tt)*) => {{
        #[cfg(feature = "with-logging")]
        {
            ::std::println!($($arg)*);
        }
    }};
}

/// Pretty-print a value for debugging, only when the `with-logging` feature is
/// enabled. A gated, statement-level replacement for `dbg!`.
#[macro_export]
macro_rules! log_dbg {
    ($val:expr $(,)?) => {{
        #[cfg(feature = "with-logging")]
        {
            ::std::println!(
                "[{}:{}] {} = {:#?}",
                ::std::file!(),
                ::std::line!(),
                ::std::stringify!($val),
                &$val
            );
        }
    }};
}