Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tokio-rs/tracing
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8544143cc4b6b04559895dea7b6547dd9fbb3ea8
Choose a base ref
..
head repository: tokio-rs/tracing
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 14e7af51bac657d617ae9481ff0daf888eb80050
Choose a head ref
Showing with 125 additions and 269 deletions.
  1. +5 −0 Cargo.toml
  2. +4 −1 examples/Cargo.toml
  3. +1 −1 examples/examples/sloggish/sloggish_subscriber.rs
  4. +1 −1 tracing-appender/src/lib.rs
  5. +3 −3 tracing-appender/src/rolling.rs
  6. +3 −0 tracing-attributes/Cargo.toml
  7. +4 −4 tracing-attributes/tests/instrument.rs
  8. +3 −0 tracing-core/Cargo.toml
  9. +5 −9 tracing-core/src/dispatcher.rs
  10. +5 −8 tracing-core/src/field.rs
  11. +3 −3 tracing-error/src/lib.rs
  12. +3 −0 tracing-futures/Cargo.toml
  13. +1 −1 tracing-futures/src/executor/futures_01.rs
  14. +0 −121 tracing-futures/src/executor/futures_preview.rs
  15. +2 −6 tracing-futures/src/executor/mod.rs
  16. +1 −0 tracing-futures/tests/std_future.rs
  17. +3 −0 tracing-journald/Cargo.toml
  18. +3 −0 tracing-log/Cargo.toml
  19. +1 −1 tracing-log/src/interest_cache.rs
  20. +3 −0 tracing-macros/Cargo.toml
  21. +3 −0 tracing-mock/Cargo.toml
  22. +3 −0 tracing-serde/Cargo.toml
  23. +0 −12 tracing-serde/src/lib.rs
  24. +4 −0 tracing-subscriber/Cargo.toml
  25. +7 −7 tracing-subscriber/src/filter/env/builder.rs
  26. +2 −2 tracing-subscriber/src/filter/env/field.rs
  27. +3 −3 tracing-subscriber/src/filter/layer_filters/mod.rs
  28. +2 −2 tracing-subscriber/src/fmt/fmt_layer.rs
  29. +3 −3 tracing-subscriber/src/fmt/format/json.rs
  30. +1 −1 tracing-subscriber/src/fmt/format/mod.rs
  31. +2 −5 tracing-subscriber/src/fmt/time/chrono_crate.rs
  32. +7 −7 tracing-subscriber/src/fmt/time/datetime.rs
  33. +4 −0 tracing-subscriber/src/fmt/writer.rs
  34. +3 −2 tracing-subscriber/src/layer/mod.rs
  35. +1 −1 tracing-subscriber/src/lib.rs
  36. +3 −6 tracing-subscriber/src/registry/sharded.rs
  37. +3 −0 tracing-tower/Cargo.toml
  38. +0 −25 tracing-tower/src/lib.rs
  39. +0 −4 tracing-tower/src/service_span.rs
  40. +5 −2 tracing/Cargo.toml
  41. +7 −7 tracing/src/macros.rs
  42. +7 −21 tracing/src/span.rs
  43. +1 −0 tracing/tests/instrument.rs
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -17,3 +17,8 @@ members = [
"tracing-journald",
"examples"
]

# This will be ignored with Rust older than 1.74, but for now that's okay;
# we're only using it to fix check-cfg issues that first appeared in Rust 1.80.
[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(flaky_tests)", "cfg(tracing_unstable)"] }
5 changes: 4 additions & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
@@ -50,9 +50,12 @@ tempfile = "3"
snafu = "0.6.10"
thiserror = "1.0.31"

# valuable examples
# valuable examples
valuable = { version = "0.1.0", features = ["derive"] }

[target.'cfg(tracing_unstable)'.dependencies]
tracing-core = { path = "../tracing-core", version = "0.1.28", features = ["valuable"]}
tracing-subscriber = { path = "../tracing-subscriber", version = "0.3.0", features = ["json", "env-filter", "valuable"]}

[lints]
workspace = true
2 changes: 1 addition & 1 deletion examples/examples/sloggish/sloggish_subscriber.rs
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ pub struct CurrentSpanPerThread {
impl CurrentSpanPerThread {
pub fn new() -> Self {
thread_local! {
static CURRENT: RefCell<Vec<Id>> = RefCell::new(vec![]);
static CURRENT: RefCell<Vec<Id>> = const { RefCell::new(vec![]) };
};
Self { current: &CURRENT }
}
2 changes: 1 addition & 1 deletion tracing-appender/src/lib.rs
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@
//! - Using a [`RollingFileAppender`][rolling_struct] to perform writes to a log file. This will block on writes.
//! - Using *any* type implementing [`std::io::Write`][write] in a non-blocking fashion.
//! - Using a combination of [`NonBlocking`][non_blocking] and [`RollingFileAppender`][rolling_struct] to allow writes to a log file
//! without blocking.
//! without blocking.
//!
//! ## File Appender
//!
6 changes: 3 additions & 3 deletions tracing-appender/src/rolling.rs
Original file line number Diff line number Diff line change
@@ -10,11 +10,11 @@
//! The following helpers are available for creating a rolling file appender.
//!
//! - [`Rotation::minutely()`][minutely]: A new log file in the format of `some_directory/log_file_name_prefix.yyyy-MM-dd-HH-mm`
//! will be created minutely (once per minute)
//! will be created minutely (once per minute)
//! - [`Rotation::hourly()`][hourly]: A new log file in the format of `some_directory/log_file_name_prefix.yyyy-MM-dd-HH`
//! will be created hourly
//! will be created hourly
//! - [`Rotation::daily()`][daily]: A new log file in the format of `some_directory/log_file_name_prefix.yyyy-MM-dd`
//! will be created daily
//! will be created daily
//! - [`Rotation::never()`][never()]: This will result in log file located at `some_directory/log_file_name`
//!
//!
3 changes: 3 additions & 0 deletions tracing-attributes/Cargo.toml
Original file line number Diff line number Diff line change
@@ -54,3 +54,6 @@ rustversion = "1.0.9"

[badges]
maintenance = { status = "experimental" }

[lints]
workspace = true
8 changes: 4 additions & 4 deletions tracing-attributes/tests/instrument.rs
Original file line number Diff line number Diff line change
@@ -100,7 +100,7 @@ fn fields() {

#[test]
fn skip() {
struct UnDebug(pub u32);
struct UnDebug();

#[instrument(target = "my_target", level = "debug", skip(_arg2, _arg3))]
fn my_fn(arg1: usize, _arg2: UnDebug, _arg3: UnDebug) {}
@@ -147,9 +147,9 @@ fn skip() {
.run_with_handle();

with_default(subscriber, || {
my_fn(2, UnDebug(0), UnDebug(1));
my_fn(3, UnDebug(0), UnDebug(1));
my_fn2(2, UnDebug(0), UnDebug(1));
my_fn(2, UnDebug(), UnDebug());
my_fn(3, UnDebug(), UnDebug());
my_fn2(2, UnDebug(), UnDebug());
});

handle.assert_finished();
3 changes: 3 additions & 0 deletions tracing-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -46,3 +46,6 @@ rustdoc-args = ["--cfg", "docsrs", "--cfg", "tracing_unstable"]
# it's necessary to _also_ pass `--cfg tracing_unstable` to rustc, or else
# dependencies will not be enabled, and the docs build will fail.
rustc-args = ["--cfg", "tracing_unstable"]

[lints]
workspace = true
14 changes: 5 additions & 9 deletions tracing-core/src/dispatcher.rs
Original file line number Diff line number Diff line change
@@ -123,6 +123,8 @@
//! currently default `Dispatch`. This is used primarily by `tracing`
//! instrumentation.
//!
use core::ptr::addr_of;

use crate::{
callsite, span,
subscriber::{self, NoSubscriber, Subscriber},
@@ -144,12 +146,6 @@ use crate::stdlib::{
error,
};

#[cfg(feature = "alloc")]
use alloc::sync::{Arc, Weak};

#[cfg(feature = "alloc")]
use core::ops::Deref;

/// `Dispatch` trace data to a [`Subscriber`].
#[derive(Clone)]
pub struct Dispatch {
@@ -187,10 +183,10 @@ enum Kind<T> {

#[cfg(feature = "std")]
thread_local! {
static CURRENT_STATE: State = State {
static CURRENT_STATE: State = const { State {
default: RefCell::new(None),
can_enter: Cell::new(true),
};
} };
}

static EXISTS: AtomicBool = AtomicBool::new(false);
@@ -455,7 +451,7 @@ fn get_global() -> &'static Dispatch {
unsafe {
// This is safe given the invariant that setting the global dispatcher
// also sets `GLOBAL_INIT` to `INITIALIZED`.
&GLOBAL_DISPATCH
&*addr_of!(GLOBAL_DISPATCH)
}
}

13 changes: 5 additions & 8 deletions tracing-core/src/field.rs
Original file line number Diff line number Diff line change
@@ -836,10 +836,7 @@ impl FieldSet {
/// Returns the [`Field`] named `name`, or `None` if no such field exists.
///
/// [`Field`]: super::Field
pub fn field<Q: ?Sized>(&self, name: &Q) -> Option<Field>
where
Q: Borrow<str>,
{
pub fn field<Q: Borrow<str> + ?Sized>(&self, name: &Q) -> Option<Field> {
let name = &name.borrow();
self.names.iter().position(|f| f == name).map(|i| Field {
i,
@@ -1090,8 +1087,8 @@ mod test {
use crate::stdlib::{borrow::ToOwned, string::String};

// Make sure TEST_CALLSITE_* have non-zero size, so they can't be located at the same address.
struct TestCallsite1(u8);
static TEST_CALLSITE_1: TestCallsite1 = TestCallsite1(0);
struct TestCallsite1();
static TEST_CALLSITE_1: TestCallsite1 = TestCallsite1();
static TEST_META_1: Metadata<'static> = metadata! {
name: "field_test1",
target: module_path!(),
@@ -1111,8 +1108,8 @@ mod test {
}
}

struct TestCallsite2(u8);
static TEST_CALLSITE_2: TestCallsite2 = TestCallsite2(0);
struct TestCallsite2();
static TEST_CALLSITE_2: TestCallsite2 = TestCallsite2();
static TEST_META_2: Metadata<'static> = metadata! {
name: "field_test2",
target: module_path!(),
6 changes: 3 additions & 3 deletions tracing-error/src/lib.rs
Original file line number Diff line number Diff line change
@@ -26,10 +26,10 @@
//!
//! - `traced-error` - Enables the [`TracedError`] type and related Traits
//! - [`InstrumentResult`] and [`InstrumentError`] extension traits, which
//! provide an [`in_current_span()`] method for bundling errors with a
//! [`SpanTrace`].
//! provide an [`in_current_span()`] method for bundling errors with a
//! [`SpanTrace`].
//! - [`ExtractSpanTrace`] extension trait, for extracting `SpanTrace`s from
//! behind `dyn Error` trait objects.
//! behind `dyn Error` trait objects.
//!
//! ## Usage
//!
3 changes: 3 additions & 0 deletions tracing-futures/Cargo.toml
Original file line number Diff line number Diff line change
@@ -51,3 +51,6 @@ maintenance = { status = "actively-developed" }
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[lints]
workspace = true
2 changes: 1 addition & 1 deletion tracing-futures/src/executor/futures_01.rs
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ where
}

#[cfg(feature = "tokio")]
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
#[allow(unreachable_pub, unused_imports)] // https://github.com/rust-lang/rust/issues/57411
pub use self::tokio::*;

#[cfg(feature = "tokio")]
121 changes: 0 additions & 121 deletions tracing-futures/src/executor/futures_preview.rs

This file was deleted.

8 changes: 2 additions & 6 deletions tracing-futures/src/executor/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#[cfg(feature = "futures-01")]
mod futures_01;

#[cfg(feature = "futures_preview")]
mod futures_preview;
#[cfg(feature = "futures_preview")]
pub use self::futures_preview::*;

#[cfg(feature = "futures-03")]
mod futures_03;
#[allow(unreachable_pub, unused_imports)]
#[cfg(feature = "futures-03")]
pub use self::futures_03::*;
pub use futures_03::*;
1 change: 1 addition & 0 deletions tracing-futures/tests/std_future.rs
Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@ fn span_on_drop() {
}
}

#[allow(dead_code)] // Field unused, but logs on `Drop`
struct Fut(Option<AssertSpanOnDrop>);

impl Future for Fut {
3 changes: 3 additions & 0 deletions tracing-journald/Cargo.toml
Original file line number Diff line number Diff line change
@@ -24,3 +24,6 @@ tracing-subscriber = { path = "../tracing-subscriber", version = "0.3.0", defaul
serde_json = "1.0.82"
serde = { version = "1.0.140", features = ["derive"] }
tracing = { path = "../tracing", version = "0.1.35" }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions tracing-log/Cargo.toml
Original file line number Diff line number Diff line change
@@ -45,3 +45,6 @@ rustdoc-args = ["--cfg", "docsrs"]
[[bench]]
name = "logging"
harness = false

[lints]
workspace = true
2 changes: 1 addition & 1 deletion tracing-log/src/interest_cache.rs
Original file line number Diff line number Diff line change
@@ -235,7 +235,7 @@ mod tests {

fn lock_for_test() -> impl Drop {
// We need to make sure only one test runs at a time.
static LOCK: Lazy<Mutex<()>> = Lazy::new(Mutex::new);
static LOCK: Lazy<Mutex<()>> = Lazy::new(|| Mutex::new(()));

match LOCK.lock() {
Ok(guard) => guard,
3 changes: 3 additions & 0 deletions tracing-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -25,3 +25,6 @@ tracing-subscriber = { path = "../tracing-subscriber", version = "0.3.0", featur

[badges]
maintenance = { status = "experimental" }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions tracing-mock/Cargo.toml
Original file line number Diff line number Diff line change
@@ -29,3 +29,6 @@ tokio-stream = { version = "0.1.9", optional = true }
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[lints]
workspace = true
3 changes: 3 additions & 0 deletions tracing-serde/Cargo.toml
Original file line number Diff line number Diff line change
@@ -34,3 +34,6 @@ valuable-serde = { version = "0.1.0", optional = true, default-features = false

[badges]
maintenance = { status = "experimental" }

[lints]
workspace = true
Loading