mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-12-28 03:54:30 +01:00
Add error for invalid log config
Log config falls back to "warn"
This commit is contained in:
parent
9c922db14b
commit
3a40bf8ae0
1 changed files with 7 additions and 3 deletions
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 a new issue