Skip to content

Commit

Permalink
Disable some logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dove6 committed Aug 15, 2024
1 parent 2724270 commit eb39604
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
6 changes: 3 additions & 3 deletions pixlib/src/plugins/events_plugin.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use bevy::{
app::{App, Plugin, Update},
log::{info, warn},
log::warn,
prelude::{Event, EventReader, EventWriter, NonSend},
};

Expand Down Expand Up @@ -96,7 +96,7 @@ fn redistribute_sound_events(
mut writer: EventWriter<PixlibSoundEvent>,
) {
for evt in runner.events_out.sound.borrow_mut().drain(..) {
info!("Redistributing sound event {}", evt);
// info!("Redistributing sound event {}", evt);
writer.send(PixlibSoundEvent(evt));
}
}
Expand All @@ -109,7 +109,7 @@ fn re_redistribute_sound_events(
if evt_id.id > 100 {
warn!("Postponed event ID: {}", evt_id.id);
};
warn!("Re-redistributing sound event {}", evt.0);
// warn!("Re-redistributing sound event {}", evt.0);
re_writer.send(PixlibSoundEvent(evt.0.clone()));
}
}
Expand Down
4 changes: 2 additions & 2 deletions pixlib/src/plugins/graphics_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub fn create_pool(mut commands: Commands) {
fn run_if_any_script_loaded(mut reader: EventReader<PixlibScriptEvent>) -> bool {
let mut any_script_loaded = false;
for evt in reader.read() {
info!("Popped event: {:?}", evt);
// info!("Popped event: {:?}", evt);
if matches!(evt.0, ScriptEvent::ScriptLoaded { .. }) {
any_script_loaded = true;
}
Expand Down Expand Up @@ -142,7 +142,7 @@ pub fn assign_pool(mut query: Query<&mut GraphicsMarker>, runner: NonSend<Script
let mut image_counter = 0;
let mut animation_counter = 0;
let mut iter = query.iter_mut();
info!("Current scene: {:?}", runner.get_current_scene());
// info!("Current scene: {:?}", runner.get_current_scene());
if let Some(current_scene) = runner.get_current_scene() {
let current_scene_guard = current_scene.content.borrow();
let current_scene: Option<&Scene> = (&*current_scene_guard).into();
Expand Down
9 changes: 8 additions & 1 deletion pixlib/src/plugins/scripts_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,14 @@ fn reload_main_script(
chosen_scene.list.push(SceneDefinition { name: scene_name });
}
chosen_scene.list.sort();
info!("scenes: {:?}", chosen_scene.list);
info!(
"scenes: {:?}",
chosen_scene
.list
.iter()
.map(|s| s.name.clone())
.collect::<Vec<_>>()
);
}

#[derive(Debug, Clone)]
Expand Down
18 changes: 8 additions & 10 deletions pixlib/src/plugins/sounds_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ pub fn create_pool(mut commands: Commands) {
fn run_if_any_script_loaded(mut reader: EventReader<PixlibScriptEvent>) -> bool {
let mut any_script_loaded = false;
for evt in reader.read() {
info!("Popped event: {:?}", evt);
// info!("Popped event: {:?}", evt);
if matches!(evt.0, ScriptEvent::ScriptLoaded { .. }) {
any_script_loaded = true;
}
Expand Down Expand Up @@ -310,15 +310,15 @@ fn update_sounds(
writer.send(PostponedPixlibSoundEvent(evt.0.clone()));
continue;
}
info!("Read sound event: {}", evt.0);
// info!("Read sound event: {}", evt.0);
for (marker, mut ident, mut handle, mut state) in query.iter_mut() {
let Some(snd_source) = &**marker else {
continue;
};
if evt_source != snd_source {
continue;
}
info!("Matched the sounds pool element");
// info!("Matched the sounds pool element");
match &evt.0 {
SoundEvent::SoundLoaded { sound_data, .. } => {
if !ident.is_some_and(|h| h == sound_data.hash) {
Expand All @@ -339,7 +339,7 @@ fn update_sounds(
ident.0 = Some(sound_data.hash);
state.position = Some(0.0);
reloaded_sources.insert(evt_source.clone());
info!("Updated data for sound {:?}", snd_source);
// info!("Updated data for sound {:?}", snd_source);
}
}
SoundEvent::SoundStarted(_) => {
Expand All @@ -352,21 +352,19 @@ fn update_sounds(
break;
};
instance.resume(EASING);
info!("Started sound {:?}", snd_source);
// info!("Started sound {:?}", snd_source);
}
SoundEvent::SoundPaused(_) => {
let Some(instance) = (*handle)
.as_ref()
.inspect(|o| info!("Handle is set: {:?}", o))
.map(|h| audio_instances.get_mut(h))
.inspect(|o| info!("Is handle registered? {:?}", o.is_some()))
.flatten()
else {
error!("Cannot retrieve audio instance for sound {:?}", snd_source);
break;
};
instance.pause(EASING);
info!("Paused sound {:?}", snd_source);
// info!("Paused sound {:?}", snd_source);
}
SoundEvent::SoundResumed(_) => {
let Some(instance) = (*handle)
Expand All @@ -378,7 +376,7 @@ fn update_sounds(
break;
};
instance.resume(EASING);
info!("Resumed sound {:?}", snd_source);
// info!("Resumed sound {:?}", snd_source);
}
SoundEvent::SoundStopped(_) => {
let Some(instance) = (*handle)
Expand All @@ -392,7 +390,7 @@ fn update_sounds(
instance.pause(EASING);
instance.seek_to(0.0);
state.position = Some(0.0);
info!("Stopped sound {:?}", snd_source);
// info!("Stopped sound {:?}", snd_source);
}
};
}
Expand Down

0 comments on commit eb39604

Please sign in to comment.