From 1005bf78067c52e4b603a9b95894fc47d135ac3e Mon Sep 17 00:00:00 2001 From: Thomas de Zeeuw Date: Mon, 11 Dec 2023 18:30:46 +0100 Subject: [PATCH] Remove log feature --- Cargo.toml | 4 ++-- src/macros.rs | 28 ---------------------------- src/poll.rs | 6 +++--- src/sys/unix/selector/epoll.rs | 2 +- src/sys/unix/selector/kqueue.rs | 2 +- src/sys/unix/selector/poll.rs | 4 ++-- src/sys/wasi/mod.rs | 2 +- 7 files changed, 10 insertions(+), 38 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e283f58c6..9648996e2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ include = [ # For documentation of features see the `mio::features` module. [features] # By default Mio only provides a shell implementation. -default = ["log"] +default = [] # Enables the `Poll` and `Registry` types. os-poll = [] @@ -45,7 +45,7 @@ os-ext = [ net = [] [dependencies] -log = { version = "0.4.8", optional = true } +log = { version = "0.4.8" } [target.'cfg(unix)'.dependencies] libc = "0.2.149" diff --git a/src/macros.rs b/src/macros.rs index e380c6b14..f97f90911 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -68,31 +68,3 @@ macro_rules! cfg_any_os_ext { )* } } - -macro_rules! trace { - ($($t:tt)*) => { - log!(trace, $($t)*) - } -} - -macro_rules! warn { - ($($t:tt)*) => { - log!(warn, $($t)*) - } -} - -macro_rules! error { - ($($t:tt)*) => { - log!(error, $($t)*) - } -} - -macro_rules! log { - ($level: ident, $($t:tt)*) => { - #[cfg(feature = "log")] - { log::$level!($($t)*) } - // Silence unused variables warnings. - #[cfg(not(feature = "log"))] - { if false { let _ = ( $($t)* ); } } - } -} diff --git a/src/poll.rs b/src/poll.rs index 092482f24..aa44ae039 100644 --- a/src/poll.rs +++ b/src/poll.rs @@ -548,7 +548,7 @@ impl Registry { where S: event::Source + ?Sized, { - trace!( + log::trace!( "registering event source with poller: token={:?}, interests={:?}", token, interests @@ -616,7 +616,7 @@ impl Registry { where S: event::Source + ?Sized, { - trace!( + log::trace!( "reregistering event source with poller: token={:?}, interests={:?}", token, interests @@ -679,7 +679,7 @@ impl Registry { where S: event::Source + ?Sized, { - trace!("deregistering event source from poller"); + log::trace!("deregistering event source from poller"); source.deregister(self) } diff --git a/src/sys/unix/selector/epoll.rs b/src/sys/unix/selector/epoll.rs index c0a8a4c16..b2b880f81 100644 --- a/src/sys/unix/selector/epoll.rs +++ b/src/sys/unix/selector/epoll.rs @@ -152,7 +152,7 @@ impl AsRawFd for Selector { impl Drop for Selector { fn drop(&mut self) { if let Err(err) = syscall!(close(self.ep)) { - error!("error closing epoll: {}", err); + log::error!("error closing epoll: {}", err); } } } diff --git a/src/sys/unix/selector/kqueue.rs b/src/sys/unix/selector/kqueue.rs index 0a2a24a57..bf7f69ef9 100644 --- a/src/sys/unix/selector/kqueue.rs +++ b/src/sys/unix/selector/kqueue.rs @@ -321,7 +321,7 @@ impl AsRawFd for Selector { impl Drop for Selector { fn drop(&mut self) { if let Err(err) = syscall!(close(self.kq)) { - error!("error closing kqueue: {}", err); + log::error!("error closing kqueue: {}", err); } } } diff --git a/src/sys/unix/selector/poll.rs b/src/sys/unix/selector/poll.rs index 8346e07bc..74de0c073 100644 --- a/src/sys/unix/selector/poll.rs +++ b/src/sys/unix/selector/poll.rs @@ -202,9 +202,9 @@ impl SelectorState { } // Perform the poll. - trace!("Polling on {:?}", &fds); + log::trace!("Polling on {:?}", &fds); let num_events = poll(&mut fds.poll_fds, timeout)?; - trace!("Poll finished: {:?}", &fds); + log::trace!("Poll finished: {:?}", &fds); if num_events == 0 { return Ok(()); diff --git a/src/sys/wasi/mod.rs b/src/sys/wasi/mod.rs index b1a25fc9d..eeea0f25d 100644 --- a/src/sys/wasi/mod.rs +++ b/src/sys/wasi/mod.rs @@ -79,7 +79,7 @@ impl Selector { debug_assert!(events.capacity() >= length); #[cfg(debug_assertions)] if length == 0 { - warn!( + log::warn!( "calling mio::Poll::poll with empty subscriptions, this likely not what you want" ); }