mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-09 22:48:54 +01:00
Log error from main using tracing
This commit is contained in:
parent
abe128476f
commit
fa77a949aa
@ -72,6 +72,19 @@ fn on_panic(info: &std::panic::PanicInfo) {
|
|||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> anyhow::Result<()> {
|
async fn main() -> anyhow::Result<()> {
|
||||||
|
try_main().await.inspect_err(|error| {
|
||||||
|
tracing::error!(%error);
|
||||||
|
let mut current = error.source();
|
||||||
|
let mut depth = 0;
|
||||||
|
while let Some(source) = current {
|
||||||
|
tracing::info!(%source, depth, "Error caused by");
|
||||||
|
current = source.source();
|
||||||
|
depth += 1;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn try_main() -> anyhow::Result<()> {
|
||||||
let (opt, config_read_from) = Opt::try_build()?;
|
let (opt, config_read_from) = Opt::try_build()?;
|
||||||
|
|
||||||
std::panic::set_hook(Box::new(on_panic));
|
std::panic::set_hook(Box::new(on_panic));
|
||||||
|
Loading…
Reference in New Issue
Block a user