mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 12:05:05 +08:00
Add panic hook to log panics
This commit is contained in:
parent
c443ed7e3f
commit
d71b77f18b
@ -48,10 +48,17 @@ fn setup(opt: &Opt) -> anyhow::Result<LogRouteHandle> {
|
|||||||
Ok(route_layer_handle)
|
Ok(route_layer_handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn on_panic(info: &std::panic::PanicInfo) {
|
||||||
|
let info = info.to_string().replace('\n', " ");
|
||||||
|
tracing::error!(%info);
|
||||||
|
}
|
||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> anyhow::Result<()> {
|
async fn 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));
|
||||||
|
|
||||||
anyhow::ensure!(
|
anyhow::ensure!(
|
||||||
!(cfg!(windows) && opt.experimental_reduce_indexing_memory_usage),
|
!(cfg!(windows) && opt.experimental_reduce_indexing_memory_usage),
|
||||||
"The `experimental-reduce-indexing-memory-usage` flag is not supported on Windows"
|
"The `experimental-reduce-indexing-memory-usage` flag is not supported on Windows"
|
||||||
|
Loading…
Reference in New Issue
Block a user