Expand description
Unified debug logging system Unified Debug Logging System for Azul
This module provides a thread-safe debug logging infrastructure that can be passed through function arguments to collect debug messages during execution.
§Design Philosophy
- No global state for logging - All logging goes through explicit parameters
- Zero-cost when disabled -
Option<&mut DebugLogger>isNonein production - Structured messages - Each message has level, category, and location
- Thread-safe collection - Can collect messages from multiple threads
§Usage Pattern
Functions that need debug logging accept debug_log: &mut Option<DebugLogger>:
ⓘ
fn do_layout(
dom: &Dom,
// ... other params ...
debug_log: &mut Option<DebugLogger>,
) {
log_debug!(debug_log, Layout, "Starting layout for {} nodes", dom.len());
// ... do work ...
}§Integration with HTTP Debug Server
When AZUL_DEBUG is set, the debug server creates a DebugLogger for each
incoming request, which collects all messages until the frame is rendered,
then returns them in the HTTP response.
Structs§
- Debug
Logger - Debug logger that collects messages during execution.
- LogMessage
- A structured log message for the debug logger
Enums§
- Debug
Category - Categories for debug messages to enable filtering
- Debug
Level - Debug message severity level
Functions§
- debug_
log - Helper function to conditionally log (when logger is Some)
- get_
debug_ port - Get the debug server port from environment variable
- is_
debug_ enabled - Check if debug mode is enabled via environment variable
Type Aliases§
- Debug
Log - Type alias for the debug logger parameter pattern used throughout the codebase