Explicitly set settings for the tracing subscriber.

This commit is contained in:
Tom Alexander 2022-11-25 17:49:38 -05:00
parent e0a9c49e9f
commit 1fcb32d3c6
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 12 additions and 1 deletions

View File

@ -1,12 +1,23 @@
use crate::parser::document;
use tracing::trace;
use tracing::Level;
mod parser;
const TEST_DOC: &'static str = include_str!("../toy_language.txt");
fn main() -> Result<(), Box<dyn std::error::Error>> {
let subscriber = tracing_subscriber::FmtSubscriber::new();
let format = tracing_subscriber::fmt::format()
.with_file(true)
.with_line_number(true)
.with_thread_ids(false)
.with_target(false);
let subscriber = tracing_subscriber::fmt()
.event_format(format)
.with_max_level(Level::TRACE)
.finish();
tracing::subscriber::set_global_default(subscriber)?;
trace!("TESTING");
println!("{}\n\n\n", TEST_DOC);
println!("{:#?}", document(TEST_DOC));
Ok(())