- Docs
- enzUI framework
- Developers
Logging
Framework diagnostics through the log facade, their targets, the default logger, RUST_LOG, the systemd journal and your own logger.
enzUI reports what it notices through the log facade, never by printing: an icon name that does not exist, two controls with the same accessibility id, an actionable control with no name, a layout floor that cannot be met. Every message has a target under enzui::, so you can filter or route it like any other library's.
Targets
| Target | What it reports |
|---|---|
enzui::a11y | Accessibility tree problems: duplicate ids, actionable nodes without an id or a name |
enzui::icon | Icon names missing from the registry (once per name) |
enzui::layout | Layout floors the parent cannot honour |
enzui::placement | Window sizes ignored as placeholders |
enzui::chart | Chart data dropped for a reserved, empty or duplicate id |
enzui::drag_drop | Duplicate drag-and-drop collection ids |
enzui::agent | Background tasks the agent integration refused |
enzui::trace::* | Opt-in traces, each turned on by its own environment variable (ENZUI_FRAME_COST, ENZUI_DIAGNOSTICS) |
The default logger
enzui_widgets::app_setup::run installs a small logger before the event loop starts, unless the application installed one first. It prints LEVEL target: message lines to stderr and reads RUST_LOG:
RUST_LOG=warn # every crate's warnings
RUST_LOG=info,enzui::a11y=off # more detail, without accessibility warnings
RUST_LOG=enzui=debug # everything enzUI saysWithout RUST_LOG the filter is error,enzui=warn,enzui::trace=info: enzUI's warnings, other crates' errors only, and the opt-in traces once their variable is set. The longest matching target prefix decides, by whole path segments.
Apps that do not use app_setup::run call enzui_core::logging::init_default() themselves.
The systemd journal
When stderr already goes to the systemd journal (systemd says so in JOURNAL_STREAM), the default logger writes to the journal in its native protocol instead. Each record keeps its priority (error 3, warning 4, info 6, debug and trace 7), its target as LOG_TARGET, and its source as CODE_FILE, CODE_LINE and CODE_MODULE. The executable's name is the SYSLOG_IDENTIFIER. enzui_core::logging::init_journal("notes") sends to the journal whatever stderr is.
journalctl --user -t notes # this application
journalctl --user -t notes -p warning # warnings and errors only
journalctl --user -t notes LOG_TARGET=enzui::a11yYour own logger
Install any log implementation before calling run and the default steps aside:
fn main() -> iced::Result {
env_logger::init(); // or tracing_subscriber with its log bridge
enzui_widgets::app_setup::run(/* .. */)
}With tracing, enable tracing-subscriber's tracing-log feature (or call tracing_log::LogTracer::init()) so log records become events.