From 643d08291471b6503f70b4eb4f8594f5d1302158 Mon Sep 17 00:00:00 2001 From: John Nunley Date: Wed, 1 Jan 2025 09:26:37 -0800 Subject: [PATCH] m: Replace 'log' with 'tracing' As done in winit. Signed-off-by: John Nunley --- Cargo.toml | 2 +- src/backends/kms.rs | 2 +- src/backends/x11.rs | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fdce0873..fb7041fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,8 +25,8 @@ x11 = ["as-raw-xcb-connection", "bytemuck", "fastrand", "rustix", "tiny-xlib", " x11-dlopen = ["tiny-xlib/dlopen", "x11rb/dl-libxcb"] [dependencies] -log = "0.4.17" raw_window_handle = { package = "raw-window-handle", version = "0.6", features = ["std"] } +tracing = { version = "0.1.41", default-features = false } [target.'cfg(all(unix, not(any(target_vendor = "apple", target_os = "android", target_os = "redox"))))'.dependencies] as-raw-xcb-connection = { version = "1.0.0", optional = true } diff --git a/src/backends/kms.rs b/src/backends/kms.rs index 1ff6682e..97b548c8 100644 --- a/src/backends/kms.rs +++ b/src/backends/kms.rs @@ -162,7 +162,7 @@ impl SurfaceInterface fo let handle = match plane_info.crtc() { Some(crtc) => crtc, None => { - log::warn!("no CRTC attached to plane, falling back to primary CRTC"); + tracing::warn!("no CRTC attached to plane, falling back to primary CRTC"); handles .filter_crtcs(plane_info.possible_crtcs()) .first() diff --git a/src/backends/x11.rs b/src/backends/x11.rs index b91081cd..9724c706 100644 --- a/src/backends/x11.rs +++ b/src/backends/x11.rs @@ -93,7 +93,7 @@ impl ContextInterface for Arc } None => { // The user didn't provide an XCB connection, so create our own. - log::info!("no XCB connection provided by the user, so spawning our own"); + tracing::info!("no XCB connection provided by the user, so spawning our own"); XCBConnection::connect(None) .swbuf_err("Failed to spawn XCB connection")? .0 @@ -102,7 +102,7 @@ impl ContextInterface for Arc let is_shm_available = is_shm_available(&connection); if !is_shm_available { - log::warn!("SHM extension is not available. Performance may be poor."); + tracing::warn!("SHM extension is not available. Performance may be poor."); } let supported_visuals = supported_visuals(&connection); @@ -209,7 +209,7 @@ impl SurfaceInterface fo } }; - log::trace!("new: window_handle={:X}", window_handle.window); + tracing::trace!("new: window_handle={:X}", window_handle.window); let window = window_handle.window.get(); // Run in parallel: start getting the window depth and (if necessary) visual. @@ -309,7 +309,7 @@ impl SurfaceInterface fo } fn resize(&mut self, width: NonZeroU32, height: NonZeroU32) -> Result<(), SoftBufferError> { - log::trace!( + tracing::trace!( "resize: window={:X}, size={}x{}", self.window, width, @@ -339,7 +339,7 @@ impl SurfaceInterface fo } fn buffer_mut(&mut self) -> Result, SoftBufferError> { - log::trace!("buffer_mut: window={:X}", self.window); + tracing::trace!("buffer_mut: window={:X}", self.window); // Finish waiting on the previous `shm::PutImage` request, if any. self.buffer.finish_wait(self.display.connection())?; @@ -349,7 +349,7 @@ impl SurfaceInterface fo } fn fetch(&mut self) -> Result, SoftBufferError> { - log::trace!("fetch: window={:X}", self.window); + tracing::trace!("fetch: window={:X}", self.window); let (width, height) = self .size @@ -418,12 +418,12 @@ impl BufferInterface .size .expect("Must set size of surface before calling `present_with_damage()`"); - log::trace!("present: window={:X}", imp.window); + tracing::trace!("present: window={:X}", imp.window); match imp.buffer { Buffer::Wire(ref wire) => { // This is a suboptimal strategy, raise a stink in the debug logs. - log::debug!("Falling back to non-SHM method for window drawing."); + tracing::debug!("Falling back to non-SHM method for window drawing."); imp.display .connection() @@ -841,7 +841,7 @@ fn create_shm_id() -> io::Result { } Err(rustix::io::Errno::EXIST) => { - log::warn!("x11: SHM ID collision at {} on try number {}", name, i); + tracing::warn!("x11: SHM ID collision at {} on try number {}", name, i); } Err(e) => return Err(e.into()), @@ -893,7 +893,7 @@ fn supported_visuals(c: &impl Connection) -> HashSet { .iter() .any(|f| (f.depth == 24 || f.depth == 32) && f.bits_per_pixel == 32) { - log::warn!("X11 server does not have a depth 24/32 format with 32 bits per pixel"); + tracing::warn!("X11 server does not have a depth 24/32 format with 32 bits per pixel"); return HashSet::new(); }