mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-16 00:00:12 +02:00
tracing: switch to unstable for 1.0. (#3266)
Enabling `tracing` integration now requires compiling with `--cfg tokio_unstable`. Once `tracing-core` guarantees the same level of stability as Tokio 1.0, unstable can be removed. Closes #3258
This commit is contained in:
@@ -102,6 +102,10 @@ mio = { version = "0.7.6", optional = true }
|
||||
num_cpus = { version = "1.8.0", optional = true }
|
||||
parking_lot = { version = "0.11.0", optional = true }
|
||||
slab = { version = "0.4.1", optional = true }
|
||||
|
||||
# Currently unstable. The API exposed by these features may be broken at any time.
|
||||
# Requires `--cfg tokio_unstable` to enable.
|
||||
[target.'cfg(tokio_unstable)'.dependencies]
|
||||
tracing = { version = "0.1.21", default-features = false, features = ["std"], optional = true } # Not in full
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
|
||||
+1
-2
@@ -133,8 +133,7 @@ several other libraries, including:
|
||||
|
||||
* [`tower`]: A library of modular and reusable components for building robust networking clients and servers.
|
||||
|
||||
* [`tracing`] (formerly `tokio-trace`): A framework for application-level
|
||||
tracing and async-aware diagnostics.
|
||||
* [`tracing`]: A framework for application-level tracing and async-aware diagnostics.
|
||||
|
||||
* [`rdbc`]: A Rust database connectivity library for MySQL, Postgres and SQLite.
|
||||
|
||||
|
||||
+9
-1
@@ -318,7 +318,6 @@
|
||||
//! - `signal`: Enables all `tokio::signal` types.
|
||||
//! - `fs`: Enables `tokio::fs` types.
|
||||
//! - `test-util`: Enables testing based infrastructure for the Tokio runtime.
|
||||
//! - `tracing`: Enables tracing events
|
||||
//!
|
||||
//! _Note: `AsyncRead` and `AsyncWrite` traits do not require any features and are
|
||||
//! always available._
|
||||
@@ -333,6 +332,15 @@
|
||||
//! synchronization primitives internally. MSRV may increase according to the
|
||||
//! _parking_lot_ release in use.
|
||||
//!
|
||||
//! ### Unstable features
|
||||
//!
|
||||
//! These feature flags enable **unstable** features. The public API may break in 1.x
|
||||
//! releases. To enable these features, the `--cfg tokio_unstable` must be passed to
|
||||
//! `rustc` when compiling. This is easiest done using the `RUSTFLAGS` env variable:
|
||||
//! `RUSTFLAGS="--cfg tokio_unstable"`.
|
||||
//!
|
||||
//! - `tracing`: Enables tracing events.
|
||||
//!
|
||||
//! [feature flags]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section
|
||||
|
||||
// Includes re-exports used by macros.
|
||||
|
||||
@@ -334,7 +334,7 @@ macro_rules! cfg_not_time {
|
||||
macro_rules! cfg_trace {
|
||||
($($item:item)*) => {
|
||||
$(
|
||||
#[cfg(feature = "tracing")]
|
||||
#[cfg(all(tokio_unstable, feature = "tracing"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "tracing")))]
|
||||
$item
|
||||
)*
|
||||
@@ -344,7 +344,7 @@ macro_rules! cfg_trace {
|
||||
macro_rules! cfg_not_trace {
|
||||
($($item:item)*) => {
|
||||
$(
|
||||
#[cfg(not(feature = "tracing"))]
|
||||
#[cfg(any(not(tokio_unstable), not(feature = "tracing")))]
|
||||
$item
|
||||
)*
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ impl Handle {
|
||||
F: Future + Send + 'static,
|
||||
F::Output: Send + 'static,
|
||||
{
|
||||
#[cfg(feature = "tracing")]
|
||||
#[cfg(all(tokio_unstable, feature = "tracing"))]
|
||||
let future = crate::util::trace::task(future, "task");
|
||||
self.spawner.spawn(future)
|
||||
}
|
||||
@@ -172,7 +172,7 @@ impl Handle {
|
||||
F: FnOnce() -> R + Send + 'static,
|
||||
R: Send + 'static,
|
||||
{
|
||||
#[cfg(feature = "tracing")]
|
||||
#[cfg(all(tokio_unstable, feature = "tracing"))]
|
||||
let func = {
|
||||
#[cfg(tokio_track_caller)]
|
||||
let location = std::panic::Location::caller();
|
||||
|
||||
Reference in New Issue
Block a user