egui_tracing is a Rust library that integrates tracing and logging capabilities with the egui immediate mode graphical user interface library. It supports both the tracing and log crates for efficient and flexible event collection and visualization.
Add egui_tracing to your Cargo.toml dependencies:
[dependencies]
egui_tracing = "0.3.0"Set up the collector once at startup and register it as a tracing layer:
let collector = egui_tracing::EventCollector::default();
tracing_subscriber::registry().with(collector.clone()).init();Then render the log view anywhere inside your egui UI:
ui.add(egui_tracing::Logs::new(collector.clone()));To localize the UI, pass a Labels value (built-in: english, portuguese):
ui.add(
egui_tracing::Logs::new(collector.clone())
.with_labels(egui_tracing::Labels::portuguese()),
);To run the example application, use the following command:
cargo run --bin example-eframeContributions to egui_tracing are welcome! Please open an issue or submit a pull request on the GitHub repository.
egui_tracing is released under the Unlicense. This means the code is in the public domain, and you can use, modify, and distribute it without any restrictions. For more information, please see the Unlicense website.
