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

Remove log feature #1738

Closed
wants to merge 2 commits into from
Closed
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
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 = "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