Skip to content

Commit

Permalink
Remove log feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomasdezeeuw committed Dec 12, 2023
1 parent 736ac94 commit 1005bf7
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 38 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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"
Expand Down
28 changes: 0 additions & 28 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)* ); } }
}
}
6 changes: 3 additions & 3 deletions src/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ impl Registry {
where
S: event::Source + ?Sized,
{
trace!(
log::trace!(
"registering event source with poller: token={:?}, interests={:?}",
token,
interests
Expand Down Expand Up @@ -616,7 +616,7 @@ impl Registry {
where
S: event::Source + ?Sized,
{
trace!(
log::trace!(
"reregistering event source with poller: token={:?}, interests={:?}",
token,
interests
Expand Down Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion src/sys/unix/selector/epoll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/sys/unix/selector/kqueue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/sys/unix/selector/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(());
Expand Down
2 changes: 1 addition & 1 deletion src/sys/wasi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
);
}
Expand Down

0 comments on commit 1005bf7

Please sign in to comment.