Log panics to the file; the previous hook still prints them.
()
| 356 | |
| 357 | /// Log panics to the file; the previous hook still prints them. |
| 358 | fn log_panics() { |
| 359 | let previous = std::panic::take_hook(); |
| 360 | std::panic::set_hook(Box::new(move |info| { |
| 361 | tracing::error!(target: PANIC_TARGET, "{info}"); |
| 362 | previous(info); |
| 363 | })); |
| 364 | } |
| 365 | |
| 366 | #[cfg(test)] |
| 367 | mod tests { |