Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Display instead of Debug to log errors. #4830

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions wgpu-core/src/device/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
if wait {
match device.wait_for_submit(last_submit_index) {
Ok(()) => (),
Err(e) => log::error!("Failed to wait for buffer {:?}: {:?}", buffer_id, e),
Err(e) => log::error!("Failed to wait for buffer {:?}: {}", buffer_id, e),
}
}
}
Expand Down Expand Up @@ -574,7 +574,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
return (id, None);
};

log::error!("Device::create_texture error {error:?}");
log::error!("Device::create_texture error: {error}");

let id = fid.assign_error(desc.label.borrow_or_default());
(id, Some(error))
Expand Down Expand Up @@ -648,7 +648,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
return (id, None);
};

log::error!("Device::create_texture error {error:?}");
log::error!("Device::create_texture error: {error}");

let id = fid.assign_error(desc.label.borrow_or_default());
(id, Some(error))
Expand Down Expand Up @@ -702,7 +702,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
return (id, None);
};

log::error!("Device::create_buffer error {error:?}");
log::error!("Device::create_buffer error: {error}");

let id = fid.assign_error(desc.label.borrow_or_default());
(id, Some(error))
Expand Down Expand Up @@ -790,7 +790,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
if wait {
match device.wait_for_submit(last_submit_index) {
Ok(()) => (),
Err(e) => log::error!("Failed to wait for texture {:?}: {:?}", texture_id, e),
Err(e) => log::error!("Failed to wait for texture {texture_id:?}: {e}"),
}
}
}
Expand Down Expand Up @@ -835,7 +835,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
return (id, None);
};

log::error!("Texture::create_view({texture_id:?}) error {error:?}");
log::error!("Texture::create_view({texture_id:?}) error: {error}");
let id = fid.assign_error(desc.label.borrow_or_default());
(id, Some(error))
}
Expand Down Expand Up @@ -865,11 +865,9 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
if wait {
match view.device.wait_for_submit(last_submit_index) {
Ok(()) => (),
Err(e) => log::error!(
"Failed to wait for texture view {:?}: {:?}",
texture_view_id,
e
),
Err(e) => {
log::error!("Failed to wait for texture view {texture_view_id:?}: {e}")
}
}
}
}
Expand Down Expand Up @@ -1217,7 +1215,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
return (id, None);
};

log::error!("Device::create_shader_module error: {error:?}");
log::error!("Device::create_shader_module error: {error}");

let id = fid.assign_error(desc.label.borrow_or_default());
(id, Some(error))
Expand Down Expand Up @@ -1274,7 +1272,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
return (id, None);
};

log::error!("Device::create_shader_module_spirv error: {error:?}");
log::error!("Device::create_shader_module_spirv error: {error}");

let id = fid.assign_error(desc.label.borrow_or_default());
(id, Some(error))
Expand Down Expand Up @@ -1598,7 +1596,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
}
}

log::error!("Device::create_render_pipeline error {error:?}");
log::error!("Device::create_render_pipeline error: {error}");

(id, Some(error))
}
Expand Down Expand Up @@ -2321,7 +2319,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
if let Some(callback) = operation.callback.take() {
callback.call(Err(err.clone()));
}
log::error!("Buffer::map_async error {err:?}");
log::error!("Buffer::map_async error: {err}");
return Err(err);
}

Expand Down
2 changes: 1 addition & 1 deletion wgpu-core/src/device/life.rs
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ impl<A: HalApi> LifetimeTracker<A> {
Ok(())
}
Err(e) => {
log::error!("Mapping failed {:?}", e);
log::error!("Mapping failed: {e}");
Err(e)
}
}
Expand Down
4 changes: 2 additions & 2 deletions wgpu-core/src/device/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ impl<A: HalApi> Device<A> {
Some(trace)
}
Err(e) => {
log::error!("Unable to start a trace in '{:?}': {:?}", path, e);
log::error!("Unable to start a trace in '{path:?}': {e}");
None
}
})),
Expand Down Expand Up @@ -3358,7 +3358,7 @@ impl<A: HalApi> Device<A> {
.unwrap()
.wait(fence, current_index, CLEANUP_WAIT_MS)
} {
log::error!("failed to wait for the device: {:?}", error);
log::error!("failed to wait for the device: {error}");
}
let mut life_tracker = self.lock_life();
let _ = life_tracker.triage_submissions(
Expand Down
Loading