pub fn log_layer() -> Option<BackendLogLayer>Expand description
The tracing layer that feeds Victauri’s backend log capture.
Add it to the app’s subscriber where the app already builds it — usually
the first lines of main, before tauri::Builder:
use tracing_subscriber::prelude::*;
tracing_subscriber::registry()
.with(tracing_subscriber::EnvFilter::new("info"))
.with(tracing_subscriber::fmt::layer())
.with(victauri_plugin::log_layer()) // ← the one added line
.init();It sees what passes the subscriber’s global filter (an EnvFilter added
with .with(...) filters every layer). Returns None — a no-op layer — in
release builds and when VICTAURI_DISABLE is set, and in release builds the
layer type itself is empty, so the line adds no Victauri code to a release
binary and can stay in the app unconditionally — unless Victauri is behind a
Cargo feature (victauri init --optional): then gate the line on that feature
too, since it names this crate. A later set_global_default cannot add a layer to a
subscriber the app already installed, which is why this is an explicit line
rather than something init() could do on its own.