mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-09 00:00:08 +02:00
chore: remove tracing. (#1680)
Historically, logging has been added haphazardly. Here, we entirely remove logging as none of it is particularly useful. In the future, we will add tracing back in order to expose useful data to the user of Tokio.
This commit is contained in:
@@ -210,7 +210,6 @@ impl Reactor {
|
||||
self.inner.io_dispatch.read().is_empty()
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(level = "debug"))]
|
||||
fn poll(&mut self, max_wait: Option<Duration>) -> io::Result<()> {
|
||||
// Block waiting for an event to happen, peeling out how many events
|
||||
// happened.
|
||||
@@ -221,17 +220,8 @@ impl Reactor {
|
||||
|
||||
// Process all the events that came in, dispatching appropriately
|
||||
|
||||
// event count is only used for tracing instrumentation.
|
||||
#[cfg(feature = "tracing")]
|
||||
let mut events = 0;
|
||||
|
||||
for event in self.events.iter() {
|
||||
#[cfg(feature = "tracing")]
|
||||
{
|
||||
events += 1;
|
||||
}
|
||||
let token = event.token();
|
||||
trace!(event.readiness = ?event.readiness(), event.token = ?token);
|
||||
|
||||
if token == TOKEN_WAKEUP {
|
||||
self.inner
|
||||
@@ -243,8 +233,6 @@ impl Reactor {
|
||||
}
|
||||
}
|
||||
|
||||
trace!(message = "loop process", events);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -400,7 +388,6 @@ impl Inner {
|
||||
};
|
||||
|
||||
let token = aba_guard | key;
|
||||
debug!(message = "adding I/O source", token);
|
||||
|
||||
self.io.register(
|
||||
source,
|
||||
@@ -418,13 +405,11 @@ impl Inner {
|
||||
}
|
||||
|
||||
pub(super) fn drop_source(&self, token: usize) {
|
||||
debug!(message = "dropping I/O source", token);
|
||||
self.io_dispatch.write().remove(token);
|
||||
}
|
||||
|
||||
/// Registers interest in the I/O resource associated with `token`.
|
||||
pub(super) fn register(&self, token: usize, dir: Direction, w: Waker) {
|
||||
debug!(message = "scheduling", direction = ?dir, token);
|
||||
let io_dispatch = self.io_dispatch.read();
|
||||
let sched = io_dispatch.get(token).unwrap();
|
||||
|
||||
|
||||
@@ -235,7 +235,6 @@ impl Registration {
|
||||
|
||||
if ready.is_empty() {
|
||||
if let Some(cx) = cx {
|
||||
debug!(message = "scheduling", ?direction, token = self.token);
|
||||
// Update the task info
|
||||
match direction {
|
||||
Direction::Read => sched.reader.register_by_ref(cx.waker()),
|
||||
|
||||
@@ -39,8 +39,6 @@
|
||||
//! [`Registration`]: struct.Registration.html
|
||||
//! [`PollEvented`]: struct.PollEvented.html
|
||||
//! [reactor module]: https://docs.rs/tokio/0.1/tokio/reactor/index.html
|
||||
#[macro_use]
|
||||
mod tracing;
|
||||
|
||||
mod addr;
|
||||
pub use addr::ToSocketAddrs;
|
||||
|
||||
@@ -69,12 +69,11 @@ impl<T: Wait> OrphanQueue<T> for AtomicOrphanQueue<T> {
|
||||
while let Ok(mut orphan) = self.queue.pop() {
|
||||
match orphan.try_wait() {
|
||||
Ok(Some(_)) => {}
|
||||
Err(e) => error!(
|
||||
message = "leaking orphaned process due to try_wait() error",
|
||||
orphan.id =orphan.id(),
|
||||
error = %e,
|
||||
),
|
||||
|
||||
Err(_) => {
|
||||
// TODO: bubble up error some how. Is this an internal bug?
|
||||
// Shoudl we panic? Is it OK for this to be silently
|
||||
// dropped?
|
||||
}
|
||||
// Still not done yet, we need to put it back in the queue
|
||||
// when were done draining it, so that we don't get stuck
|
||||
// in an infinite loop here
|
||||
|
||||
@@ -659,7 +659,6 @@ impl TcpStream {
|
||||
unsafe {
|
||||
buf.advance_mut(n);
|
||||
}
|
||||
trace!(tcp.written.bytes = n);
|
||||
Poll::Ready(Ok(n))
|
||||
}
|
||||
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
//! This module provides a small facade that wraps the `tracing` APIs we use, so
|
||||
//! that when the `tracing` dependency is disabled, `tracing`'s macros expand to
|
||||
//! no-ops.
|
||||
//!
|
||||
//! This means we don't have to put a `#[cfg(feature = "tracing")]` on every
|
||||
//! individual use of a `tracing` macro.
|
||||
|
||||
// The macros in this module may or may not be used depending on the combination
|
||||
// of feature flags enabled. Rather than feature-flagging each individual macro
|
||||
// to only be defined when the features that use it are enabled, just allow
|
||||
// unused macros in some cases.
|
||||
#![allow(unused_macros)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[cfg(not(feature = "tracing"))]
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct Span {}
|
||||
|
||||
#[cfg(feature = "tracing")]
|
||||
macro_rules! trace {
|
||||
($($arg:tt)+) => {
|
||||
tracing::trace!($($arg)+)
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "tracing"))]
|
||||
macro_rules! trace {
|
||||
($($arg:tt)+) => {{}};
|
||||
}
|
||||
|
||||
#[cfg(feature = "tracing")]
|
||||
macro_rules! debug {
|
||||
($($arg:tt)+) => {
|
||||
tracing::debug!($($arg)+)
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "tracing"))]
|
||||
macro_rules! debug {
|
||||
($($arg:tt)+) => {{}};
|
||||
}
|
||||
|
||||
#[cfg(feature = "tracing")]
|
||||
macro_rules! error {
|
||||
($($arg:tt)+) => {
|
||||
tracing::error!($($arg)+)
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "tracing"))]
|
||||
macro_rules! error {
|
||||
($($arg:tt)+) => {{}};
|
||||
}
|
||||
|
||||
#[cfg(feature = "tracing")]
|
||||
macro_rules! trace_span {
|
||||
($($arg:tt)+) => {
|
||||
tracing::trace_span!($($arg)+)
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "tracing"))]
|
||||
macro_rules! trace_span {
|
||||
($($arg:tt)+) => {
|
||||
crate::tracing::Span::new()
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "tracing"))]
|
||||
impl Span {
|
||||
pub(crate) fn new() -> Self {
|
||||
Span {}
|
||||
}
|
||||
|
||||
pub(crate) fn enter(&self) -> Span {
|
||||
Span {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user