pub fn setup_panic_handler()Expand description
Sets up a custom panic hook for the application with advanced features.
This function configures panic behavior based on the build profile:
- Debug builds: Uses
better_panicfor verbose, immediate, and diagnostic-rich panics with full stack traces. - Release builds: Uses
human_panicfor graceful, user-friendly panics that log internally without exposing sensitive details, prioritizing user experience.
Additionally, it provides a mechanism to catch panics from spawned Tokio tasks.
This function should be called only once. Subsequent calls will be ignored.