pub fn layer<W, F>(
filter: F,
make_writer: W,
) -> Box<dyn Layer<Registry> + Send + Sync>Expand description
Build a stdout fmt layer that emits CloudLogging JSON, filtered by
filter.
make_writer is the sink. Production code passes std::io::stdout, and
tests pass a capturing buffer.
filter is any per-layer [Filter], not only an EnvFilter: a service
that retargets its log level at runtime passes a filter it can swap out
from under this layer.
The function returns a boxed layer over a [Registry], so call sites
compose it with tracing_subscriber::registry().with(...).