Skip to main content

safe_debug

Macro safe_debug 

Source
macro_rules! safe_debug {
    ($fmt:expr, $text:expr, $max:expr) => { ... };
    ($fmt:expr, $text:expr, $max:expr, $($arg:tt)*) => { ... };
}
Expand description

Macro for safe debug logging with automatic string truncation

Use this instead of log::debug!() when logging string slices that might contain multi-byte UTF-8 characters. It automatically truncates safely.

ยงExamples

use marco_core::safe_debug;

let input = "Text with emoji ๐Ÿ˜€ and em dash โ€”";
safe_debug!("Parsing paragraph from: {:?}", input, 40);
safe_debug!("Short preview: {:?}", input, 20);