print_tracing

Function print_tracing 

Source
pub fn print_tracing(
    max: Level,
    span_events: bool,
    filter: impl Fn(&Metadata<'_>) -> bool + Send + Sync + 'static,
) -> bool
Expand description

Enables tracing events printing if a subscriber is not already set.

All non-fatal errors in the Zng project are logged using tracing, printing these errors is essential for debugging. In debug builds this is enabled by default in the app-process on app init with INFO level and no span events.

If span_events are enabled tracing::span! enter and exit are also printed as events.

In "wasm32" builds logs to the browser console.

In "android" builds logs to logcat.

See also test_log to enable panicking on error log.

See also print_tracing_filter for the filter used by this.

ยงExamples

In the example below this function is called before init!, enabling it in all app processes.

fn main() {
    zng::app::print_tracing(tracing::Level::INFO, false, |_| true);
    zng::env::init!();
}