Crate nr_tracing_layer

Source
Expand description

A tracing layer that sends logs to New Relic.

§Example

use nr_tracing_layer::NewRelicOptions;
use tracing_subscriber::prelude::*;
use tracing::{instrument, subscriber};

#[instrument]
fn log(msg: &'static str) {
  tracing::info!("your message: {}", msg);
}

fn main() {
    let options = NewRelicOptions::new("my-service", "my-new-relic-api-key")
        .with_tags("env:dev");
    let dd = nr_tracing_layer::create(options);
    let subscriber = tracing_subscriber::registry()
        .with(tracing_subscriber::fmt::Layer::new().json())
        .with(dd);
    let _s = subscriber::set_default(subscriber);
    log("hello world!");
}

Structs§

LogLayer
NewRelicOptions

Enums§

Region

Functions§

create
Creates a log layer that will send logs to New Relic.