use tracing (if enabled) for stream error + sink fmt

This commit is contained in:
github-actions[bot] 2024-09-28 02:44:58 +02:00
parent 1a7b8e5e8f
commit 95a466e03a
No known key found for this signature in database
GPG key ID: F687E89FC7894F98
2 changed files with 7 additions and 2 deletions

View file

@ -195,7 +195,12 @@ impl CpalDeviceExt for cpal::Device {
let (mixer_tx, mut mixer_rx) =
dynamic_mixer::mixer::<f32>(format.channels(), format.sample_rate().0);
let error_callback = |err| eprintln!("an error occurred on output stream: {err}");
let error_callback = |err| {
#[cfg(feature = "tracing")]
tracing::error!("an error occurred on output stream: {err}");
#[cfg(not(feature = "tracing"))]
eprintln!("an error occurred on output stream: {err}");
};
match format.sample_format() {
cpal::SampleFormat::F32 => self.build_output_stream::<f32, _, _>(