use tracing_subscriber::prelude::*;
fn main() {
let subscriber = tracing_subscriber::registry().with(
tracing_ndjson::builder()
.with_level_name("severity")
.with_level_value_casing(tracing_ndjson::Casing::Uppercase)
.with_timestamp_name("ts")
.with_timestamp_format(tracing_ndjson::TimestampFormat::UnixMillis)
.with_message_name("msg")
.with_line_numbers(true)
.with_file_names(true)
.layer(),
);
tracing::subscriber::set_global_default(subscriber).unwrap();
tracing::info!(life = 42, "Hello, world!");
let span = tracing::info_span!("hello", "request.uri" = "https://example.com");
span.in_scope(|| {
tracing::info!("Hello, world!");
});
}