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

Replace 'log' with 'tracing' #251

Merged
merged 1 commit into from
Jan 1, 2025
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
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(all(unix, not(any(target_vendor = "apple", target_os = "android", target_os = "redox"))))'.dependencies]
as-raw-xcb-connection = { version = "1.0.0", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion src/backends/kms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,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 @@ -209,7 +209,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 @@ -309,7 +309,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 @@ -339,7 +339,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 @@ -349,7 +349,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 @@ -418,12 +418,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 @@ -841,7 +841,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 @@ -893,7 +893,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
Loading