Skip to content

Commit 9c17a55

Browse files
committed
m: Replace 'log' with 'tracing'
As done in winit. Signed-off-by: John Nunley <[email protected]>
1 parent a16fb9a commit 9c17a55

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ x11 = ["as-raw-xcb-connection", "bytemuck", "fastrand", "rustix", "tiny-xlib", "
2525
x11-dlopen = ["tiny-xlib/dlopen", "x11rb/dl-libxcb"]
2626

2727
[dependencies]
28-
log = "0.4.17"
2928
raw_window_handle = { package = "raw-window-handle", version = "0.6", features = ["std"] }
29+
tracing = { version = "0.1.41", default-features = false }
3030

3131
[target.'cfg(target_os = "android")'.dependencies]
3232
bytemuck = "1.12.3"

src/backends/kms.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W> fo
160160
let handle = match plane_info.crtc() {
161161
Some(crtc) => crtc,
162162
None => {
163-
log::warn!("no CRTC attached to plane, falling back to primary CRTC");
163+
tracing::warn!("no CRTC attached to plane, falling back to primary CRTC");
164164
handles
165165
.filter_crtcs(plane_info.possible_crtcs())
166166
.first()

src/backends/x11.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl<D: HasDisplayHandle + ?Sized> ContextInterface<D> for Arc<X11DisplayImpl<D>
9393
}
9494
None => {
9595
// The user didn't provide an XCB connection, so create our own.
96-
log::info!("no XCB connection provided by the user, so spawning our own");
96+
tracing::info!("no XCB connection provided by the user, so spawning our own");
9797
XCBConnection::connect(None)
9898
.swbuf_err("Failed to spawn XCB connection")?
9999
.0
@@ -102,7 +102,7 @@ impl<D: HasDisplayHandle + ?Sized> ContextInterface<D> for Arc<X11DisplayImpl<D>
102102

103103
let is_shm_available = is_shm_available(&connection);
104104
if !is_shm_available {
105-
log::warn!("SHM extension is not available. Performance may be poor.");
105+
tracing::warn!("SHM extension is not available. Performance may be poor.");
106106
}
107107

108108
let supported_visuals = supported_visuals(&connection);
@@ -207,7 +207,7 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W> fo
207207
}
208208
};
209209

210-
log::trace!("new: window_handle={:X}", window_handle.window);
210+
tracing::trace!("new: window_handle={:X}", window_handle.window);
211211
let window = window_handle.window.get();
212212

213213
// Run in parallel: start getting the window depth and (if necessary) visual.
@@ -307,7 +307,7 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W> fo
307307
}
308308

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

339339
fn buffer_mut(&mut self) -> Result<BufferImpl<'_, D, W>, SoftBufferError> {
340-
log::trace!("buffer_mut: window={:X}", self.window);
340+
tracing::trace!("buffer_mut: window={:X}", self.window);
341341

342342
// Finish waiting on the previous `shm::PutImage` request, if any.
343343
self.buffer.finish_wait(self.display.connection())?;
@@ -347,7 +347,7 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W> fo
347347
}
348348

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

352352
let (width, height) = self
353353
.size
@@ -416,12 +416,12 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle + ?Sized> BufferInterface
416416
.size
417417
.expect("Must set size of surface before calling `present_with_damage()`");
418418

419-
log::trace!("present: window={:X}", imp.window);
419+
tracing::trace!("present: window={:X}", imp.window);
420420

421421
match imp.buffer {
422422
Buffer::Wire(ref wire) => {
423423
// This is a suboptimal strategy, raise a stink in the debug logs.
424-
log::debug!("Falling back to non-SHM method for window drawing.");
424+
tracing::debug!("Falling back to non-SHM method for window drawing.");
425425

426426
imp.display
427427
.connection()
@@ -834,7 +834,7 @@ fn create_shm_id() -> io::Result<OwnedFd> {
834834
}
835835

836836
Err(rustix::io::Errno::EXIST) => {
837-
log::warn!("x11: SHM ID collision at {} on try number {}", name, i);
837+
tracing::warn!("x11: SHM ID collision at {} on try number {}", name, i);
838838
}
839839

840840
Err(e) => return Err(e.into()),
@@ -886,7 +886,7 @@ fn supported_visuals(c: &impl Connection) -> HashSet<Visualid> {
886886
.iter()
887887
.any(|f| (f.depth == 24 || f.depth == 32) && f.bits_per_pixel == 32)
888888
{
889-
log::warn!("X11 server does not have a depth 24/32 format with 32 bits per pixel");
889+
tracing::warn!("X11 server does not have a depth 24/32 format with 32 bits per pixel");
890890
return HashSet::new();
891891
}
892892

0 commit comments

Comments
 (0)