mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-29 00:00:11 +02:00
net: switch from log to tracing (#1455)
* net: switch from `log` to `tracing`. Motivation: The `tracing` crate implements scoped, structured, context-aware diagnostics, which can add significant debugging value over unstructured log messages. `tracing` is part of the Tokio project. As part of the `tokio` 0.2 changes, I thought it would be good to move over from `log` to `tracing` in the tokio runtime. Solution: This branch replaces the use of `log` in `tokio-net` with `tracing`. I've tried to leave all the instrumentation points more or less the same, but modified to use structured fields instead of string interpolation. Notes: I removed the timing in `Reactor::poll` in favor of simply adding a `#[tracing::instrument]` attribute. Since the generated `tracing` span will have enter and exit events, a `tracing::Subscriber` implemementation can use those to record timestamps, and process that timing data in a much more sophisticated manner than including it in a log line. We can add the timestamps back if they're desired. Signed-off-by: Eliza Weisman <[email protected]>
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
use crossbeam_queue::SegQueue;
|
||||
use log::error;
|
||||
use std::io;
|
||||
use std::process::ExitStatus;
|
||||
|
||||
@@ -71,9 +70,9 @@ impl<T: Wait> OrphanQueue<T> for AtomicOrphanQueue<T> {
|
||||
match orphan.try_wait() {
|
||||
Ok(Some(_)) => {}
|
||||
Err(e) => error!(
|
||||
"leaking orphaned process {} due to try_wait() error: {}",
|
||||
orphan.id(),
|
||||
e,
|
||||
message = "leaking orphaned process due to try_wait() error",
|
||||
orphan.id =orphan.id(),
|
||||
error = %e,
|
||||
),
|
||||
|
||||
// Still not done yet, we need to put it back in the queue
|
||||
|
||||
Reference in New Issue
Block a user