mirror of
https://github.com/RustAudio/rodio
synced 2024-12-12 13:12:30 +00:00
use tracing (if enabled) for stream error + sink fmt
This commit is contained in:
parent
1a7b8e5e8f
commit
95a466e03a
2 changed files with 7 additions and 2 deletions
|
@ -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, _, _>(
|
||||
|
|
Loading…
Reference in a new issue