Skip to main content

Module debug_trace

Module debug_trace 

Source
Expand description

Zero-cost debug tracing controlled by environment variable.

Enable runtime debug output by setting FTUI_DEBUG_TRACE=1 before launching your application, with stderr redirected. When disabled (the default), the trace checks compile down to a single static bool load with no other overhead.

The trace stays off while stderr is a terminal: that is the terminal the UI draws on, and a trace line written there lands between frames (bd-g00-root-epic-ewths.33.4).

§Usage

FTUI_DEBUG_TRACE=1 cargo run -p ftui-demo-showcase 2>trace.log

This module provides debug_trace! macro for conditional debug output:

ⓘ
use ftui_runtime::debug_trace;
debug_trace!("loop iteration {}", count);

Functions§

elapsed_ms
Get elapsed time since program start in milliseconds.
is_enabled
Check if debug tracing is enabled.