pub fn layer<S: Subscriber + for<'a> LookupSpan<'a>>(
) -> Layer<S, JsonFields, HCLogJson, fn() -> Stderr>
Expand description

Create a tracing Layer configured to log events in a format understood by Grafana.

The returned layer should be installed into the tracing subscriber registry, with an optional env filter.

Example

Installing the layer with the default EnvFilter (using the RUST_LOG environment variable):

use grafana_plugin_sdk::backend;
use tracing_subscriber::{prelude::*, EnvFilter};

tracing_subscriber::registry()
    .with(backend::layer())
    .with(EnvFilter::from_default_env())
    .init();