diff options
author | Eliza Weisman <eliza@buoyant.io> | 2019-08-27 17:53:57 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-27 17:53:57 -0700 |
commit | 9c31797a087165660a689f7430b6be1ce8eeaa63 (patch) | |
tree | e6e5d52df85b332edab46f553d877cbafca6a3c8 /tokio | |
parent | d1c58b7940de6e4baea4ac99b6433742962c11c1 (diff) |
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 <eliza@buoyant.io>
Diffstat (limited to 'tokio')
-rw-r--r-- | tokio/Cargo.toml | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tokio/Cargo.toml b/tokio/Cargo.toml index 9e4b24ac..d8b585f7 100644 --- a/tokio/Cargo.toml +++ b/tokio/Cargo.toml @@ -75,6 +75,7 @@ tokio-timer = { version = "=0.3.0-alpha.2", optional = true, path = "../tokio-ti tracing-core = { version = "0.1", optional = true } [target.'cfg(feature = "tracing")'.dependencies] +tokio-net = { version = "=0.2.0-alpha.2", optional = true, path = "../tokio-net", features = ["tracing", "async-traits"] } tokio-executor = { version = "=0.2.0-alpha.2", optional = true, path = "../tokio-executor", features = ["tracing"] } [dev-dependencies] |