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

migrate println statements to DEBUG-level logging #64

Merged
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ vger = "0.2.8"
accesskit = "0.11.0"
lazy_static = "1.4.0"
winit = { version = "0.28.1", optional = true }
log = "0.4"

# Seems we can't publish to crates.io with this dependency.
# baseview = { git = "https://github.com/RustAudio/baseview", optional = true }
Expand Down
8 changes: 4 additions & 4 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ impl Context {
assert_eq!(path.len(), 1);

if nodes != *access_nodes {
println!("access nodes:");
log::debug!("access nodes:");
for (id, node) in &nodes {
println!(
log::debug!(
" id: {:?} role: {:?}, children: {:?}",
id,
node.role(),
Expand All @@ -209,7 +209,7 @@ impl Context {
}
*access_nodes = nodes;
} else {
// println!("access nodes unchanged");
// log::debug!("access nodes unchanged");
}

// XXX: we're doing layout both here and in rendering.
Expand Down Expand Up @@ -330,7 +330,7 @@ impl Context {

for action in actions {
if !action.is::<()>() {
println!("unhandled action: {:?}", action.type_id());
log::debug!("unhandled action: {:?}", action.type_id());
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions src/winit_event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub fn on_main(f: impl FnOnce(&mut Context) + Send + 'static) {
let opt_proxy = GLOBAL_EVENT_LOOP_PROXY.lock().unwrap();
if let Some(proxy) = &*opt_proxy {
if let Err(err) = proxy.send_event(()) {
println!("error waking up event loop: {:?}", err);
log::debug!("error waking up event loop: {:?}", err);
}
}
}
Expand Down Expand Up @@ -86,7 +86,7 @@ async fn setup(window: &Window) -> Setup {
#[cfg(not(target_arch = "wasm32"))]
{
let adapter_info = adapter.get_info();
println!("Using {} ({:?})", adapter_info.name, adapter_info.backend);
log::debug!("Using {} ({:?})", adapter_info.name, adapter_info.backend);
}

let trace_dir = std::env::var("WGPU_TRACE");
Expand Down Expand Up @@ -115,7 +115,7 @@ fn process_event(cx: &mut Context, view: &impl View, event: &Event, window: &Win
cx.process(view, event);

if cx.grab_cursor && !cx.prev_grab_cursor {
println!("grabbing cursor");
log::debug!("grabbing cursor");
window
.set_cursor_grab(winit::window::CursorGrabMode::Locked)
.or_else(|_e| window.set_cursor_grab(winit::window::CursorGrabMode::Confined))
Expand All @@ -124,7 +124,7 @@ fn process_event(cx: &mut Context, view: &impl View, event: &Event, window: &Win
}

if !cx.grab_cursor && cx.prev_grab_cursor {
println!("releasing cursor");
log::debug!("releasing cursor");
window
.set_cursor_grab(winit::window::CursorGrabMode::None)
.unwrap();
Expand Down Expand Up @@ -195,7 +195,7 @@ pub fn rui(view: impl View) {
event: WindowEvent::CloseRequested,
..
} => {
println!("The close button was pressed; stopping");
log::debug!("The close button was pressed; stopping");
*control_flow = ControlFlow::Exit
}
WEvent::WindowEvent {
Expand All @@ -207,14 +207,14 @@ pub fn rui(view: impl View) {
},
..
} => {
// println!("Resizing to {:?}", size);
// log::debug!("Resizing to {:?}", size);
config.width = size.width.max(1);
config.height = size.height.max(1);
surface.configure(&device, &config);
window.request_redraw();
}
WEvent::UserEvent(_) => {
// println!("received user event");
// log::debug!("received user event");

// Process the work queue.
#[cfg(not(target_arch = "wasm32"))]
Expand All @@ -235,7 +235,7 @@ pub fn rui(view: impl View) {

let window_size = window.inner_size();
let scale = window.scale_factor() as f32;
// println!("window_size: {:?}", window_size);
// log::debug!("window_size: {:?}", window_size);
let width = window_size.width as f32 / scale;
let height = window_size.height as f32 / scale;

Expand All @@ -257,11 +257,11 @@ pub fn rui(view: impl View) {

let window_size = window.inner_size();
let scale = window.scale_factor() as f32;
// println!("window_size: {:?}", window_size);
// log::debug!("window_size: {:?}", window_size);
let width = window_size.width as f32 / scale;
let height = window_size.height as f32 / scale;

// println!("RedrawRequested");
// log::debug!("RedrawRequested");
cx.render(
RenderInfo {
device: &device,
Expand Down
Loading