Skip to content

Commit

Permalink
m: Replace 'log' with 'tracing'
Browse files Browse the repository at this point in the history
As done in winit.

Signed-off-by: John Nunley <dev@notgull.net>
  • Loading branch information
notgull committed Jan 1, 2025
1 parent a16fb9a commit 9c17a55
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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(target_os = "android")'.dependencies]
bytemuck = "1.12.3"
Expand Down
2 changes: 1 addition & 1 deletion src/backends/kms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W> 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()
Expand Down
20 changes: 10 additions & 10 deletions src/backends/x11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl<D: HasDisplayHandle + ?Sized> ContextInterface<D> for Arc<X11DisplayImpl<D>
}
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
Expand All @@ -102,7 +102,7 @@ impl<D: HasDisplayHandle + ?Sized> ContextInterface<D> for Arc<X11DisplayImpl<D>

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);
Expand Down Expand Up @@ -207,7 +207,7 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W> 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.
Expand Down Expand Up @@ -307,7 +307,7 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W> fo
}

fn resize(&mut self, width: NonZeroU32, height: NonZeroU32) -> Result<(), SoftBufferError> {
log::trace!(
tracing::trace!(
"resize: window={:X}, size={}x{}",
self.window,
width,
Expand Down Expand Up @@ -337,7 +337,7 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W> fo
}

fn buffer_mut(&mut self) -> Result<BufferImpl<'_, D, W>, 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())?;
Expand All @@ -347,7 +347,7 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W> fo
}

fn fetch(&mut self) -> Result<Vec<u32>, SoftBufferError> {
log::trace!("fetch: window={:X}", self.window);
tracing::trace!("fetch: window={:X}", self.window);

let (width, height) = self
.size
Expand Down Expand Up @@ -416,12 +416,12 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle + ?Sized> 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()
Expand Down Expand Up @@ -834,7 +834,7 @@ fn create_shm_id() -> io::Result<OwnedFd> {
}

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()),
Expand Down Expand Up @@ -886,7 +886,7 @@ fn supported_visuals(c: &impl Connection) -> HashSet<Visualid> {
.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();
}

Expand Down

0 comments on commit 9c17a55

Please sign in to comment.