desktop: Switch from log to tracing

This commit is contained in:
Nathan Adams 2023-01-04 11:42:43 +01:00
parent a7738bec69
commit ab6012c42c
7 changed files with 22 additions and 20 deletions

2
Cargo.lock generated
View File

@ -3414,11 +3414,11 @@ dependencies = [
"env_logger",
"generational-arena",
"isahc",
"log",
"rfd",
"ruffle_core",
"ruffle_render_wgpu",
"ruffle_video_software",
"tracing",
"url",
"webbrowser",
"winapi",

View File

@ -15,7 +15,7 @@ ruffle_render_wgpu = { path = "../render/wgpu", features = ["clap"] }
ruffle_video_software = { path = "../video/software", optional = true }
env_logger = { version = "0.10", default-features = false, features = ["humantime"] }
generational-arena = "0.2.8"
log = "0.4"
tracing = "0.1.37"
winit = "0.27.5"
webbrowser = "0.8.4"
url = "2.3.1"

View File

@ -34,7 +34,7 @@ impl CpalAudioBackend {
// Start the audio stream.
let stream = {
let mixer = mixer.proxy();
let error_handler = move |err| log::error!("Audio stream error: {}", err);
let error_handler = move |err| tracing::error!("Audio stream error: {}", err);
match sample_format {
cpal::SampleFormat::F32 => device.build_output_stream(

View File

@ -180,7 +180,7 @@ impl GlutinAsyncExecutor {
Poll::Pending => {}
Poll::Ready(r) => {
if let Err(e) = r {
log::error!("Async error: {}", e);
tracing::error!("Async error: {}", e);
}
completed_tasks.push(index);
@ -202,16 +202,18 @@ impl GlutinAsyncExecutor {
if !self.waiting_for_poll {
self.waiting_for_poll = true;
if self.event_loop.send_event(RuffleEvent::TaskPoll).is_err() {
log::warn!("A task was queued on an event loop that has already ended. It will not be polled.");
tracing::warn!("A task was queued on an event loop that has already ended. It will not be polled.");
}
} else {
log::info!("Double polling");
tracing::info!("Double polling");
}
} else {
log::warn!("A Waker was invoked after the task it was attached to was completed.");
tracing::warn!(
"A Waker was invoked after the task it was attached to was completed."
);
}
} else {
log::warn!("Attempted to wake an already-finished task");
tracing::warn!("Attempted to wake an already-finished task");
}
}
}

View File

@ -235,7 +235,7 @@ impl App {
match audio::CpalAudioBackend::new() {
Ok(audio) => builder = builder.with_audio(audio),
Err(e) => {
log::error!("Unable to create audio device: {}", e);
tracing::error!("Unable to create audio device: {}", e);
}
};

View File

@ -82,7 +82,7 @@ impl NavigatorBackend for ExternalNavigatorBackend {
let mut parsed_url = match Url::parse(&url) {
Ok(parsed_url) => parsed_url,
Err(e) => {
log::error!(
tracing::error!(
"Could not parse URL because of {}, the corrupt URL was: {}",
e,
url
@ -111,7 +111,7 @@ impl NavigatorBackend for ExternalNavigatorBackend {
match webbrowser::open(processed_url.as_ref()) {
Ok(_output) => {}
Err(e) => log::error!("Could not open URL {}: {}", processed_url.as_str(), e),
Err(e) => tracing::error!("Could not open URL {}: {}", processed_url.as_str(), e),
};
}
@ -207,7 +207,7 @@ impl NavigatorBackend for ExternalNavigatorBackend {
self.channel.send(future).expect("working channel send");
if self.event_loop.send_event(RuffleEvent::TaskPoll).is_err() {
log::warn!(
tracing::warn!(
"A task was queued on an event loop that has already ended. It will not be polled."
);
}
@ -215,7 +215,7 @@ impl NavigatorBackend for ExternalNavigatorBackend {
fn pre_process_url(&self, mut url: Url) -> Url {
if self.upgrade_to_https && url.scheme() == "http" && url.set_scheme("https").is_err() {
log::error!("Url::set_scheme failed on: {}", url);
tracing::error!("Url::set_scheme failed on: {}", url);
}
url
}

View File

@ -16,9 +16,9 @@ impl DiskStorageBackend {
// Create a base dir if one doesn't exist yet
if !shared_objects_path.exists() {
log::info!("Creating storage dir");
tracing::info!("Creating storage dir");
if let Err(r) = fs::create_dir_all(&base_path) {
log::warn!("Unable to create storage dir {}", r);
tracing::warn!("Unable to create storage dir {}", r);
}
}
@ -58,13 +58,13 @@ impl StorageBackend for DiskStorageBackend {
match std::fs::read(path) {
Ok(data) => Some(data),
Err(e) => {
log::warn!("Unable to read file {:?}", e);
tracing::warn!("Unable to read file {:?}", e);
None
}
}
}
Err(e) => {
log::warn!("Unable to read file {:?}", e);
tracing::warn!("Unable to read file {:?}", e);
None
}
}
@ -78,7 +78,7 @@ impl StorageBackend for DiskStorageBackend {
if let Some(parent_dir) = path.parent() {
if !parent_dir.exists() {
if let Err(r) = fs::create_dir_all(&parent_dir) {
log::warn!("Unable to create storage dir {}", r);
tracing::warn!("Unable to create storage dir {}", r);
return false;
}
}
@ -87,14 +87,14 @@ impl StorageBackend for DiskStorageBackend {
match File::create(path) {
Ok(mut file) => {
if let Err(r) = file.write_all(value) {
log::warn!("Unable to write file content {:?}", r);
tracing::warn!("Unable to write file content {:?}", r);
false
} else {
true
}
}
Err(r) => {
log::warn!("Unable to save file {:?}", r);
tracing::warn!("Unable to save file {:?}", r);
false
}
}