From 3a0847771d8ec2248e71f7afdcc070e387f17102 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Wed, 7 Feb 2024 17:29:40 +0100 Subject: [PATCH] Add panic hook to log panics --- meilisearch/src/main.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meilisearch/src/main.rs b/meilisearch/src/main.rs index ccbe761fe..f7a8e6cff 100644 --- a/meilisearch/src/main.rs +++ b/meilisearch/src/main.rs @@ -48,10 +48,17 @@ fn setup(opt: &Opt) -> anyhow::Result { Ok(route_layer_handle) } +fn on_panic(info: &std::panic::PanicInfo) { + let info = info.to_string().replace('\n', " "); + tracing::error!(%info); +} + #[actix_web::main] async fn main() -> anyhow::Result<()> { let (opt, config_read_from) = Opt::try_build()?; + std::panic::set_hook(Box::new(on_panic)); + anyhow::ensure!( !(cfg!(windows) && opt.experimental_reduce_indexing_memory_usage), "The `experimental-reduce-indexing-memory-usage` flag is not supported on Windows"