Skip to main content

Module debug

Module debug 

Source
Expand description

Debug logging for external macros. Writes to .macroforge/debug.log relative to the project root. Use: macroforge_ts::debug::log("tag", "message") or macroforge_ts::debug_log!("tag", "...") Debug logging for external macros.

Writes timestamped log entries to .macroforge/debug.log relative to the project root (discovered by walking up from CWD). The file is created on first write and appended to thereafter.

§Usage

use macroforge_ts::debug;

debug::log("Gigaform", "Starting expansion for User");
debug::log_ctx("Gigaform", &ctx);            // logs the full MacroContextIR
debug::log_result("Gigaform", &result);       // logs patch/diagnostic counts

Or use the debug_log! macro for formatted messages:

macroforge_ts::debug_log!("MyMacro", "processing {type_name} with {n} fields");

Functions§

clear
Clear the debug log (useful at the start of a build).
log
Append a single line to the debug log.
log_ctx
Log the MacroContextIR summary (macro name, module, file, target kind, field count).
log_result
Log a MacroResult summary (patch counts, diagnostic counts, token length).