Macro debg

Source
macro_rules! debg {
    ($($fmt:expr),+) => { ... };
}
Expand description

A macro for custom debug logging.

This macro checks if the current logging level is set to 4 or higher, indicating that debug-level messages should be printed. If the condition is met, it formats the provided arguments using format_args!, and then prints them with a specific format including colored annotations for better readability in the terminal. The output includes an indentation prefix, a “DEBG” tag in green, the formatted message in cyan, and the originating file and line number. The macro utilizes thread-local storage for the indentation level, ensuring that debugging messages are neatly organized according to the current execution context.