Skip to main content

layer

Function layer 

Source
pub fn layer() -> (LogCollector, impl Layer<Registry> + Send + Sync + 'static)
Expand description

Builds the buffer layer and its LogCollector handle without installing a global subscriber. Use this when composing the collector with other layers; it returns the layer pre-wrapped in the reloadable filter.

Typical pattern for buffer + stderr fmt:

use iroh_services::logs;
use tracing_subscriber::prelude::*;

let (collector, log_layer) = logs::layer();
tracing_subscriber::registry()
    .with(log_layer)
    .with(tracing_subscriber::fmt::layer())
    .try_init()
    .ok();