bevy_log_events
bevy_log_events is a Bevy plugin that introduce the LogEvent trait for Bevy's App. It will helps you log your Event while allowing you to configure independently how each events are logged even during program execution.
Features
- Easily log your events by adding a single line of code for each of them.
- You can configure independently how each events will be logged using the
LoggedEventSettings<E>resources. - Your settings are saved when you exit your application and reloaded the next time you launch it.
- Using
bevy_editor_plsand theeditor_windowfeature, you can use a window to edit the settings for all your logged events :

Usage
Add the crate to your Cargo.toml :
cargo add bevy_log_events
Then you just have to add the LogEventsPlugin plugin and use the functions from the LogEvent trait to log your events :
use Duration;
use ;
use *;
// You must implement Debug for the events you want to log
// MyEvent will be sent and logged every second at the end of each frame
// MyEvent will be triggered and logged every second during Update
Examples
To run the minimal example from above :
cargo run --example simple
To run an example with more events and the bevy_editor_pls window use :
cargo run --example window --features editor_window
To see a more complete example with triggered events check the copy of the official bevy example of observers :
cargo run --example observers --features editor_window
Cargo Features
editor_window
This feature add an editor window that you can use to edit the LoggedEventSettings<E> resources for all the events you have registered.
To use it you will need to add the bevy_editor_pls as a dependecy of your project and add the EditorPlugin to your app before the LogEventsPlugin.
enabled
This feature if removed will entirely disable the LogEventsPlugin and the functions from the LogEvent trait to make them do nothing. No systems will be added, no resources will be inserted and no logging will occur.
To remove it you can setup your Cargo.toml as this :
[]
// Create a feature to state that the crate is enabled
= ["bevy_log_events/enabled"]
// You may want to set that feature as default
= ["dev"]
[]
// Declare that you do not want default-feautres in your dependencies
= { = "0.3", = false }
Then you can run your program as follow :
// If you do not set the feature dev as default do
cargo run --features dev
// Otherwise run your program without default features
cargo run --no-default-features
Note
Events registred with the use of log_event or add_and_log_event are all logged in the Last schedule inside the LogEventSet at the end of each frame. So keep in mind that these events will be log with a delay and if many events of different types are send in the same frame they may not be logged in the same order they were sent.
Bevy Versions Table
| bevy_log_events | bevy | bevy_editor_pls |
|---|---|---|
| 0.3 | 0.14 | 0.9 - 0.10 |
| 0.2 | 0.14 | 0.9 - 0.10 |
| 0.1 | 0.13 | 0.8 |