#![feature(round_char_boundary)] use crate::parser::document; use tracing_subscriber::EnvFilter; mod parser; use tracing_subscriber::layer::SubscriberExt; use tracing_subscriber::util::SubscriberInitExt; const TEST_DOC: &'static str = include_str!("../toy_language.txt"); fn main() -> Result<(), Box> { init_telemetry()?; let parsed = document(TEST_DOC); println!("{}\n\n\n", TEST_DOC); println!("{:#?}", parsed); Ok(()) } fn init_telemetry() -> Result<(), Box> { let env_filter = EnvFilter::try_from_default_env().unwrap_or(EnvFilter::new("WARN")); // let stdout = tracing_subscriber::fmt::Layer::new() // .pretty() // .with_file(true) // .with_line_number(true) // .with_thread_ids(false) // .with_target(false); opentelemetry::global::set_text_map_propagator(opentelemetry_jaeger::Propagator::new()); let tracer = opentelemetry_jaeger::new_pipeline() .with_service_name("toy_language") .install_simple()?; let opentelemetry = tracing_opentelemetry::layer().with_tracer(tracer); tracing_subscriber::registry() .with(env_filter) .with(opentelemetry) // .with(stdout) .try_init()?; Ok(()) }