mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-16 18:28:22 -07:00
Add error for invalid log config
Log config falls back to "warn"
This commit is contained in:
parent
9c922db14b
commit
3a40bf8ae0
10
src/main.rs
10
src/main.rs
@ -110,9 +110,13 @@ async fn main() {
|
||||
start.await;
|
||||
} else {
|
||||
let fmt_layer = tracing_subscriber::fmt::Layer::new();
|
||||
let filter_layer = EnvFilter::try_new(&config.log)
|
||||
.or_else(|_| EnvFilter::try_new("info"))
|
||||
.unwrap();
|
||||
let filter_layer = match EnvFilter::try_new(&config.log) {
|
||||
Ok(s) => s,
|
||||
Err(e) => {
|
||||
eprintln!("It looks like your log config is invalid. The following error occurred: {}", e);
|
||||
EnvFilter::try_new("warn").unwrap()
|
||||
},
|
||||
};
|
||||
|
||||
let subscriber = registry.with(filter_layer).with(fmt_layer);
|
||||
tracing::subscriber::set_global_default(subscriber).unwrap();
|
||||
|
Loading…
Reference in New Issue
Block a user