mirror of
https://github.com/bevyengine/bevy
synced 2024-11-23 05:03:47 +00:00
Don't log a trace if EventWriter::send_batch is empty (#7753)
# Objective Fix #5026. ## Solution Only make a `trace!` log if the event count changed. --- ## Changelog Changed: `EventWriter::send_batch` will only log a TRACE level log if the batch is non-empty.
This commit is contained in:
parent
2a598d3e5a
commit
4e15d3d8bb
1 changed files with 9 additions and 5 deletions
|
@ -640,6 +640,7 @@ impl<E: Event> std::iter::Extend<E> for Events<E> {
|
|||
where
|
||||
I: IntoIterator<Item = E>,
|
||||
{
|
||||
let old_count = self.event_count;
|
||||
let mut event_count = self.event_count;
|
||||
let events = iter.into_iter().map(|event| {
|
||||
let event_id = EventId {
|
||||
|
@ -652,11 +653,14 @@ impl<E: Event> std::iter::Extend<E> for Events<E> {
|
|||
|
||||
self.events_b.extend(events);
|
||||
|
||||
trace!(
|
||||
"Events::extend() -> ids: ({}..{})",
|
||||
self.event_count,
|
||||
event_count
|
||||
);
|
||||
if old_count != event_count {
|
||||
trace!(
|
||||
"Events::extend() -> ids: ({}..{})",
|
||||
self.event_count,
|
||||
event_count
|
||||
);
|
||||
}
|
||||
|
||||
self.event_count = event_count;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue