bevy/crates
François 258f495352 log spans on panic when trace is enabled (#3848)
# Objective

- Help debug panics

## Solution

- Insert a custom panic hook when trace is enabled that will log spans

example when running a command on a despawned entity

before:
```
thread 'main' panicked at 'Could not add a component (of type `panic::Marker`) to entity 1v0 because it doesn't exist in this World.
If this command was added to a newly spawned entity, ensure that you have not despawned that entity within the same stage.
This may have occurred due to system order ambiguity, or if the spawning system has multiple command buffers', /bevy/crates/bevy_ecs/src/system/commands/mod.rs:664:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```


after:
```
   0: bevy_ecs::schedule::stage::system_commands
           with name="panic::my_bad_system"
             at crates/bevy_ecs/src/schedule/stage.rs:871
   1: bevy_ecs::schedule::stage
           with name=Update
             at crates/bevy_ecs/src/schedule/mod.rs:340
   2: bevy_app::app::frame
             at crates/bevy_app/src/app.rs:111
   3: bevy_app::app::bevy_app
             at crates/bevy_app/src/app.rs:126
thread 'main' panicked at 'Could not add a component (of type `panic::Marker`) to entity 1v0 because it doesn't exist in this World.
If this command was added to a newly spawned entity, ensure that you have not despawned that entity within the same stage.
This may have occurred due to system order ambiguity, or if the spawning system has multiple command buffers', /bevy/crates/bevy_ecs/src/system/commands/mod.rs:664:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
2022-02-28 22:27:20 +00:00
..
bevy_app Make get_resource (and friends) infallible (#4047) 2022-02-27 22:37:18 +00:00
bevy_asset Make get_resource (and friends) infallible (#4047) 2022-02-27 22:37:18 +00:00
bevy_audio Update rodio 0.15 (#3846) 2022-02-03 04:25:44 +00:00
bevy_core Make get_resource (and friends) infallible (#4047) 2022-02-27 22:37:18 +00:00
bevy_core_pipeline Make get_resource (and friends) infallible (#4047) 2022-02-27 22:37:18 +00:00
bevy_crevice Don't panic in macro shape validation (#3647) 2022-01-15 22:14:43 +00:00
bevy_derive small and mostly pointless refactoring (#2934) 2022-02-13 22:33:55 +00:00
bevy_diagnostic small and mostly pointless refactoring (#2934) 2022-02-13 22:33:55 +00:00
bevy_dylib Release 0.6.0 (#3587) 2022-01-08 10:18:22 +00:00
bevy_dynamic_plugin Release 0.6.0 (#3587) 2022-01-08 10:18:22 +00:00
bevy_ecs Make get_resource (and friends) infallible (#4047) 2022-02-27 22:37:18 +00:00
bevy_ecs_compile_fail_tests Release 0.6.0 (#3587) 2022-01-08 10:18:22 +00:00
bevy_gilrs Release 0.6.0 (#3587) 2022-01-08 10:18:22 +00:00
bevy_gltf Mesh vertex buffer layouts (#3959) 2022-02-23 23:21:13 +00:00
bevy_input Proper prehashing (#3963) 2022-02-18 03:26:01 +00:00
bevy_internal log spans on panic when trace is enabled (#3848) 2022-02-28 22:27:20 +00:00
bevy_log log spans on panic when trace is enabled (#3848) 2022-02-28 22:27:20 +00:00
bevy_macro_utils small and mostly pointless refactoring (#2934) 2022-02-13 22:33:55 +00:00
bevy_math Release 0.6.0 (#3587) 2022-01-08 10:18:22 +00:00
bevy_pbr bevy_pbr: Optimize assign_lights_to_clusters (#3984) 2022-02-28 22:02:06 +00:00
bevy_reflect Updated visibility of reflected trait (#4034) 2022-02-25 07:05:51 +00:00
bevy_render Expose draw indirect (#4056) 2022-02-28 10:26:49 +00:00
bevy_scene Make get_resource (and friends) infallible (#4047) 2022-02-27 22:37:18 +00:00
bevy_sprite Make get_resource (and friends) infallible (#4047) 2022-02-27 22:37:18 +00:00
bevy_tasks small and mostly pointless refactoring (#2934) 2022-02-13 22:33:55 +00:00
bevy_text Make get_resource (and friends) infallible (#4047) 2022-02-27 22:37:18 +00:00
bevy_transform small and mostly pointless refactoring (#2934) 2022-02-13 22:33:55 +00:00
bevy_ui Make get_resource (and friends) infallible (#4047) 2022-02-27 22:37:18 +00:00
bevy_utils Proper prehashing (#3963) 2022-02-18 03:26:01 +00:00
bevy_window Make get_resource (and friends) infallible (#4047) 2022-02-27 22:37:18 +00:00
bevy_winit Make get_resource (and friends) infallible (#4047) 2022-02-27 22:37:18 +00:00