summaryrefslogtreecommitdiffstats
path: root/vendor/tracing
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:37 +0000
commit246f239d9f40f633160f0c18f87a20922d4e77bb (patch)
tree5a88572663584b3d4d28e5a20e10abab1be40884 /vendor/tracing
parentReleasing progress-linux version 1.64.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-246f239d9f40f633160f0c18f87a20922d4e77bb.tar.xz
rustc-246f239d9f40f633160f0c18f87a20922d4e77bb.zip
Merging debian version 1.65.0+dfsg1-2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/tracing')
-rw-r--r--vendor/tracing/.cargo-checksum.json2
-rw-r--r--vendor/tracing/CHANGELOG.md30
-rw-r--r--vendor/tracing/Cargo.toml48
-rw-r--r--vendor/tracing/README.md10
-rw-r--r--vendor/tracing/benches/baseline.rs24
-rw-r--r--vendor/tracing/benches/dispatch_get_clone.rs15
-rw-r--r--vendor/tracing/benches/dispatch_get_ref.rs16
-rw-r--r--vendor/tracing/benches/empty_span.rs43
-rw-r--r--vendor/tracing/benches/enter_span.rs16
-rw-r--r--vendor/tracing/benches/event.rs12
-rw-r--r--vendor/tracing/benches/global_subscriber.rs136
-rw-r--r--vendor/tracing/benches/no_subscriber.rs101
-rw-r--r--vendor/tracing/benches/shared.rs160
-rw-r--r--vendor/tracing/benches/span_fields.rs23
-rw-r--r--vendor/tracing/benches/span_no_fields.rs13
-rw-r--r--vendor/tracing/benches/span_repeated.rs20
-rw-r--r--vendor/tracing/benches/subscriber.rs189
-rw-r--r--vendor/tracing/src/lib.rs6
-rw-r--r--vendor/tracing/src/span.rs18
-rw-r--r--vendor/tracing/src/subscriber.rs17
-rw-r--r--vendor/tracing/tests/event.rs24
21 files changed, 464 insertions, 459 deletions
diff --git a/vendor/tracing/.cargo-checksum.json b/vendor/tracing/.cargo-checksum.json
index 404d4f3c0..7b9d07340 100644
--- a/vendor/tracing/.cargo-checksum.json
+++ b/vendor/tracing/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"CHANGELOG.md":"7d5517e1ac705d5d8574915b59a37bbd0ba5aa6e663fc272b75e5792eca572a9","Cargo.toml":"f6290faffd0bf079845dbd6c3c1ddb6c728bcf7225e3b56a4ba5a9478dc72a8b","LICENSE":"898b1ae9821e98daf8964c8d6c7f61641f5f5aa78ad500020771c0939ee0dea1","README.md":"a83e1a8287e3eca752383ae849872707dddfbd07b918806cc7c027a0824872c6","benches/global_subscriber.rs":"271213baed0e02054e506c1ec9c47b58696c78aaa46f0969a147f4c369f80e3d","benches/no_subscriber.rs":"495c9a91fb972ec61ced31ef8e19d2cca02ec8ffae4e98e3316e55f6a0074578","benches/subscriber.rs":"c609be119ed6e4d3fb79df77f15aa14effbd3e2f77c627a49229a50091d3ee6a","src/dispatcher.rs":"a8158e1901c50dc83d2f15b1773e6b9e31985d9af65e460be52dbf8be6874cd2","src/field.rs":"55c7a2798b9ad0269e7c738c3f15a5d0281bf34ac3a6196a3f0b15801e5278bd","src/instrument.rs":"1fe4de5c13b5ba048e9872d78d1fa4e85655f9f2ed10f79b72b5da881c9b8b45","src/level_filters.rs":"baae8e797897bae9cdd9ec64b8e9a3d71156e9c03261be17b5b18acba034e154","src/lib.rs":"a8ab6b578f93b5fb833942fc59642e67caca8d343670d64fb52d47d5507a67e4","src/macros.rs":"f1a83930cea322f1f2000548d91800c22a9e28d2daf3f178c7c7c3ac8da5a02d","src/span.rs":"96b6c86be09c97b15b2ab5c607013abc5b388c2870eb648bee2cfc07837fa6e9","src/stdlib.rs":"248514a9bae6106e436358aee44c92abf8e7f79022895c4a25136ddef211d198","src/subscriber.rs":"ae879c373be7ee4935f7b02a345f92ccbeb7879d61c5d37e3cc1277b3d51ddb2","tests/enabled.rs":"1333339aace87ea9d701f2f76a1985820cc513a75013a7ed89669f7a2c635479","tests/event.rs":"c4ec3ac338475e9e61675551eb99df1d8a7cbefb05a0d60203994f5c1df7c784","tests/filter_caching_is_lexically_scoped.rs":"5487a37db5fbdf3d57020ab1f01185d928c45d967d99d723ffc434540459d8dc","tests/filters_are_not_reevaluated_for_the_same_span.rs":"251abbc000dddd298448958a1f0e5be71da527ac6c1a368d57837c83a5467329","tests/filters_are_reevaluated_for_different_call_sites.rs":"e0fdd8e930c043674702831b4d96f331e63aba824576bbac50b3f53bb0241cc7","tests/filters_dont_leak.rs":"d594266818a3461886da33bfcc76937d89a433ed6980226fc428706b216c093c","tests/future_send.rs":"3e9c9193219d12e342c18bbedb2f6ec940334202feb3cffba91601d6001b8575","tests/macro_imports.rs":"d5de857162185d4a2384f3cb644bfcf76c7f5c1a3b5f72bfa0d2620ac6e3873c","tests/macros.rs":"fa83397181d73d2cae09c16d9647a63d1e3bad0f2dbc5b3280f69f3d0180c488","tests/macros_incompatible_concat.rs":"5f3bcbb65e4ae39db1cfc2def62fc913c20bab0fb769c8f731504e2615585ee5","tests/macros_redefined_core.rs":"a6eac60522f71fe6c9a040b8b869d596f7eb9e907f5b49f4be4413a40c387676","tests/max_level_hint.rs":"9b366591d947ca0202fa0bdf797e1bb14534d3c896cf8b9674660cd2807c32ef","tests/multiple_max_level_hints.rs":"4d9ef0de9cccc787da8f5e3f6c233ac9db42a2a99cfe5e39997e1f4aa9df0c00","tests/no_subscriber.rs":"2f8f2ada5089d8e2e503394dfe8206598a11895907c53bf940b892f1e6afdd2f","tests/register_callsite_deadlock.rs":"c0b3142543e7a10065c7583a8ee0b6bc978ea4f3979599651101c5a28966e7c8","tests/scoped_clobbers_default.rs":"806480a74c15e4d68bb7576050662b1e53ee765fd583d003f8b349f17ea63a4b","tests/span.rs":"f84ead5b1dad9b91e5cec9d8378ab932a942936374ba928fb381e67fab52cda0","tests/subscriber.rs":"1617c098f4fa6abed174fe062111444c7b67fa0f377d2b342176998e572480e3"},"package":"a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160"} \ No newline at end of file
+{"files":{"CHANGELOG.md":"dc3017cca8de9a33d8e0c3cba87b3977b1c84e1fe16ff87bc36614572ddd5832","Cargo.toml":"e4ffa43825ed68447646e39babd364b737b1353f95a7a6baa995879ad282952d","LICENSE":"898b1ae9821e98daf8964c8d6c7f61641f5f5aa78ad500020771c0939ee0dea1","README.md":"2a2ff5fa337287734c28e856a185afbced4cd656791a1aaeef0b982784e601d7","benches/baseline.rs":"43a3e31b6c33dba2e6328052301b707b212487b83f0dcffc843061a9c48a2319","benches/dispatch_get_clone.rs":"866239abeb74a82440741c948a4e7e0a44e92e8cc87319ec57e3b057c9e8f5dd","benches/dispatch_get_ref.rs":"dd2803259a6784c256304e676bbce05de233e4c8451ac85863787213343e9be7","benches/empty_span.rs":"9f51cf376414ea751b2f50c357f2435a545d606118286f5b8b89f185e28aad8c","benches/enter_span.rs":"4410ec73d277e7b54e9f306c00ff3b79a150d1832966b7fc29984c8e3ad8d57c","benches/event.rs":"98de3c82ed18abe0a3cbe6eda9a4f9deec2b69bca42c3aac11dea4b608b85a67","benches/shared.rs":"2623311af7d153685064e664a5903d03e7dc3179754c324f3a76f29f060515e6","benches/span_fields.rs":"9166cd43ef2783e5419dd61ea57a02e48e8cc38aa1b357e9b79fa581929b60d8","benches/span_no_fields.rs":"79cc4befacf27d7ce728246087c4f06a6066f913e831d9043caeb7941f0193f6","benches/span_repeated.rs":"e4b3c99a7a9fc15d9042b8db399a56cf647b4eebd26f29d95325bb057b68330b","src/dispatcher.rs":"a8158e1901c50dc83d2f15b1773e6b9e31985d9af65e460be52dbf8be6874cd2","src/field.rs":"55c7a2798b9ad0269e7c738c3f15a5d0281bf34ac3a6196a3f0b15801e5278bd","src/instrument.rs":"1fe4de5c13b5ba048e9872d78d1fa4e85655f9f2ed10f79b72b5da881c9b8b45","src/level_filters.rs":"baae8e797897bae9cdd9ec64b8e9a3d71156e9c03261be17b5b18acba034e154","src/lib.rs":"c7edb1602b2e9d164bc90f9d0dff48abb2fad840c07c6283481255fbe5d321e6","src/macros.rs":"f1a83930cea322f1f2000548d91800c22a9e28d2daf3f178c7c7c3ac8da5a02d","src/span.rs":"372695b3eda8354a892316826d2598f821fcb835fb18e1e0271767bce730b7ad","src/stdlib.rs":"248514a9bae6106e436358aee44c92abf8e7f79022895c4a25136ddef211d198","src/subscriber.rs":"8933d8766439f929c0a98a0863d20aff37b221314b3825edd9058be511149968","tests/enabled.rs":"1333339aace87ea9d701f2f76a1985820cc513a75013a7ed89669f7a2c635479","tests/event.rs":"7678d1cc8a29ae8b716fbddb7cc4836422732ba3dce109ff511c8bb6100da606","tests/filter_caching_is_lexically_scoped.rs":"5487a37db5fbdf3d57020ab1f01185d928c45d967d99d723ffc434540459d8dc","tests/filters_are_not_reevaluated_for_the_same_span.rs":"251abbc000dddd298448958a1f0e5be71da527ac6c1a368d57837c83a5467329","tests/filters_are_reevaluated_for_different_call_sites.rs":"e0fdd8e930c043674702831b4d96f331e63aba824576bbac50b3f53bb0241cc7","tests/filters_dont_leak.rs":"d594266818a3461886da33bfcc76937d89a433ed6980226fc428706b216c093c","tests/future_send.rs":"3e9c9193219d12e342c18bbedb2f6ec940334202feb3cffba91601d6001b8575","tests/macro_imports.rs":"d5de857162185d4a2384f3cb644bfcf76c7f5c1a3b5f72bfa0d2620ac6e3873c","tests/macros.rs":"fa83397181d73d2cae09c16d9647a63d1e3bad0f2dbc5b3280f69f3d0180c488","tests/macros_incompatible_concat.rs":"5f3bcbb65e4ae39db1cfc2def62fc913c20bab0fb769c8f731504e2615585ee5","tests/macros_redefined_core.rs":"a6eac60522f71fe6c9a040b8b869d596f7eb9e907f5b49f4be4413a40c387676","tests/max_level_hint.rs":"9b366591d947ca0202fa0bdf797e1bb14534d3c896cf8b9674660cd2807c32ef","tests/multiple_max_level_hints.rs":"4d9ef0de9cccc787da8f5e3f6c233ac9db42a2a99cfe5e39997e1f4aa9df0c00","tests/no_subscriber.rs":"2f8f2ada5089d8e2e503394dfe8206598a11895907c53bf940b892f1e6afdd2f","tests/register_callsite_deadlock.rs":"c0b3142543e7a10065c7583a8ee0b6bc978ea4f3979599651101c5a28966e7c8","tests/scoped_clobbers_default.rs":"806480a74c15e4d68bb7576050662b1e53ee765fd583d003f8b349f17ea63a4b","tests/span.rs":"f84ead5b1dad9b91e5cec9d8378ab932a942936374ba928fb381e67fab52cda0","tests/subscriber.rs":"1617c098f4fa6abed174fe062111444c7b67fa0f377d2b342176998e572480e3"},"package":"2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307"} \ No newline at end of file
diff --git a/vendor/tracing/CHANGELOG.md b/vendor/tracing/CHANGELOG.md
index 1c527f2de..8b7d58808 100644
--- a/vendor/tracing/CHANGELOG.md
+++ b/vendor/tracing/CHANGELOG.md
@@ -1,3 +1,33 @@
+# 0.1.36 (July 29, 2022)
+
+This release adds support for owned values and fat pointers as arguments to the
+`Span::record` method, as well as updating the minimum `tracing-core` version
+and several documentation improvements.
+
+### Fixed
+
+- Incorrect docs in `dispatcher::set_default` ([#2220])
+- Compilation with `-Z minimal-versions` ([#2246])
+
+### Added
+
+- Support for owned values and fat pointers in `Span::record` ([#2212])
+- Documentation improvements ([#2208], [#2163])
+
+### Changed
+
+- `tracing-core`: updated to [0.1.29][core-0.1.29]
+
+Thanks to @fredr, @cgbur, @jyn514, @matklad, and @CAD97 for contributing to this
+release!
+
+[core-0.1.29]: https://github.com/tokio-rs/tracing/releases/tag/tracing-core-0.1.29
+[#2220]: https://github.com/tokio-rs/tracing/pull/2220
+[#2246]: https://github.com/tokio-rs/tracing/pull/2246
+[#2212]: https://github.com/tokio-rs/tracing/pull/2212
+[#2208]: https://github.com/tokio-rs/tracing/pull/2208
+[#2163]: https://github.com/tokio-rs/tracing/pull/2163
+
# 0.1.35 (June 8, 2022)
This release reduces the overhead of callsite registration by using new
diff --git a/vendor/tracing/Cargo.toml b/vendor/tracing/Cargo.toml
index dd6f1fb47..9b4b5fa80 100644
--- a/vendor/tracing/Cargo.toml
+++ b/vendor/tracing/Cargo.toml
@@ -13,7 +13,7 @@
edition = "2018"
rust-version = "1.49.0"
name = "tracing"
-version = "0.1.35"
+version = "0.1.36"
authors = [
"Eliza Weisman <eliza@buoyant.io>",
"Tokio Contributors <team@tokio.rs>",
@@ -52,37 +52,65 @@ rustc-args = [
]
[[bench]]
-name = "subscriber"
+name = "baseline"
harness = false
[[bench]]
-name = "no_subscriber"
+name = "dispatch_get_clone"
+harness = false
+
+[[bench]]
+name = "dispatch_get_ref"
+harness = false
+
+[[bench]]
+name = "empty_span"
+harness = false
+
+[[bench]]
+name = "enter_span"
+harness = false
+
+[[bench]]
+name = "event"
+harness = false
+
+[[bench]]
+name = "span_fields"
+harness = false
+
+[[bench]]
+name = "span_no_fields"
+harness = false
+
+[[bench]]
+name = "span_repeated"
harness = false
[dependencies.cfg-if]
version = "1.0.0"
[dependencies.log]
-version = "0.4"
+version = "0.4.17"
optional = true
[dependencies.pin-project-lite]
-version = "0.2"
+version = "0.2.9"
[dependencies.tracing-attributes]
-version = "0.1.20"
+version = "0.1.22"
optional = true
[dependencies.tracing-core]
-version = "0.1.27"
+version = "0.1.29"
default-features = false
[dev-dependencies.criterion]
-version = "0.3"
-default_features = false
+version = "0.3.6"
+default-features = false
[dev-dependencies.log]
-version = "0.4"
+version = "0.4.17"
[features]
async-await = []
diff --git a/vendor/tracing/README.md b/vendor/tracing/README.md
index 5da141a3a..16e671e05 100644
--- a/vendor/tracing/README.md
+++ b/vendor/tracing/README.md
@@ -16,9 +16,9 @@ Application-level tracing for Rust.
[Documentation][docs-url] | [Chat][discord-url]
[crates-badge]: https://img.shields.io/crates/v/tracing.svg
-[crates-url]: https://crates.io/crates/tracing/0.1.35
+[crates-url]: https://crates.io/crates/tracing
[docs-badge]: https://docs.rs/tracing/badge.svg
-[docs-url]: https://docs.rs/tracing/0.1.35
+[docs-url]: https://docs.rs/tracing
[docs-master-badge]: https://img.shields.io/badge/docs-master-blue
[docs-master-url]: https://tracing-rs.netlify.com/tracing
[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg
@@ -250,7 +250,7 @@ my_future
is as long as the future's.
The second, and preferred, option is through the
-[`#[instrument]`](https://docs.rs/tracing/0.1.35/tracing/attr.instrument.html)
+[`#[instrument]`](https://docs.rs/tracing/0.1.36/tracing/attr.instrument.html)
attribute:
```rust
@@ -297,7 +297,7 @@ span.in_scope(|| {
// Dropping the span will close it, indicating that it has ended.
```
-The [`#[instrument]`](https://docs.rs/tracing/0.1.35/tracing/attr.instrument.html) attribute macro
+The [`#[instrument]`](https://docs.rs/tracing/0.1.36/tracing/attr.instrument.html) attribute macro
can reduce some of this boilerplate:
```rust
@@ -395,6 +395,7 @@ maintained by the `tokio` project. These include:
framework for validating the behavior of `tracing` spans.
- [`sentry-tracing`] provides a layer for reporting events and traces to [Sentry].
- [`tracing-loki`] provides a layer for shipping logs to [Grafana Loki].
+- [`tracing-logfmt`] provides a layer that formats events and spans into the logfmt format.
If you're the maintainer of a `tracing` ecosystem crate not listed above,
please let us know! We'd love to add your project to the list!
@@ -424,6 +425,7 @@ please let us know! We'd love to add your project to the list!
[Sentry]: https://sentry.io/welcome/
[`tracing-loki`]: https://crates.io/crates/tracing-loki
[Grafana Loki]: https://grafana.com/oss/loki/
+[`tracing-logfmt`]: https://crates.io/crates/tracing-logfmt
**Note:** that some of the ecosystem crates are currently unreleased and
undergoing active development. They may be less stable than `tracing` and
diff --git a/vendor/tracing/benches/baseline.rs b/vendor/tracing/benches/baseline.rs
new file mode 100644
index 000000000..93c14f422
--- /dev/null
+++ b/vendor/tracing/benches/baseline.rs
@@ -0,0 +1,24 @@
+use criterion::{black_box, criterion_group, criterion_main, Criterion};
+
+fn bench(c: &mut Criterion) {
+ use std::sync::atomic::{AtomicUsize, Ordering};
+
+ let mut group = c.benchmark_group("comparison");
+ group.bench_function("relaxed_load", |b| {
+ let foo = AtomicUsize::new(1);
+ b.iter(|| black_box(foo.load(Ordering::Relaxed)));
+ });
+ group.bench_function("acquire_load", |b| {
+ let foo = AtomicUsize::new(1);
+ b.iter(|| black_box(foo.load(Ordering::Acquire)))
+ });
+ group.bench_function("log", |b| {
+ b.iter(|| {
+ log::log!(log::Level::Info, "log");
+ })
+ });
+ group.finish();
+}
+
+criterion_group!(benches, bench);
+criterion_main!(benches);
diff --git a/vendor/tracing/benches/dispatch_get_clone.rs b/vendor/tracing/benches/dispatch_get_clone.rs
new file mode 100644
index 000000000..15577c696
--- /dev/null
+++ b/vendor/tracing/benches/dispatch_get_clone.rs
@@ -0,0 +1,15 @@
+use criterion::{black_box, criterion_group, criterion_main, Criterion};
+
+mod shared;
+
+fn bench(c: &mut Criterion) {
+ shared::for_all_dispatches(&mut c.benchmark_group("Dispatch::get_clone"), |b| {
+ b.iter(|| {
+ let current = tracing::dispatcher::get_default(|current| current.clone());
+ black_box(current);
+ })
+ });
+}
+
+criterion_group!(benches, bench);
+criterion_main!(benches);
diff --git a/vendor/tracing/benches/dispatch_get_ref.rs b/vendor/tracing/benches/dispatch_get_ref.rs
new file mode 100644
index 000000000..a59c34379
--- /dev/null
+++ b/vendor/tracing/benches/dispatch_get_ref.rs
@@ -0,0 +1,16 @@
+use criterion::{black_box, criterion_group, criterion_main, Criterion};
+
+mod shared;
+
+fn bench(c: &mut Criterion) {
+ shared::for_all_dispatches(&mut c.benchmark_group("Dispatch::get_ref"), |b| {
+ b.iter(|| {
+ tracing::dispatcher::get_default(|current| {
+ black_box(&current);
+ })
+ })
+ });
+}
+
+criterion_group!(benches, bench);
+criterion_main!(benches);
diff --git a/vendor/tracing/benches/empty_span.rs b/vendor/tracing/benches/empty_span.rs
new file mode 100644
index 000000000..fb38b08e1
--- /dev/null
+++ b/vendor/tracing/benches/empty_span.rs
@@ -0,0 +1,43 @@
+use criterion::{black_box, criterion_group, criterion_main, Criterion};
+
+mod shared;
+
+fn bench(c: &mut Criterion) {
+ let mut group = c.benchmark_group("empty_span");
+ shared::for_all_dispatches(&mut group, |b| {
+ b.iter(|| {
+ let span = tracing::span::Span::none();
+ black_box(&span);
+ })
+ });
+ group.bench_function("baseline_struct", |b| {
+ b.iter(|| {
+ let span = FakeEmptySpan::new();
+ black_box(&span);
+ })
+ });
+}
+
+struct FakeEmptySpan {
+ inner: Option<(usize, std::sync::Arc<()>)>,
+ meta: Option<&'static ()>,
+}
+
+impl FakeEmptySpan {
+ fn new() -> Self {
+ Self {
+ inner: None,
+ meta: None,
+ }
+ }
+}
+
+impl Drop for FakeEmptySpan {
+ fn drop(&mut self) {
+ black_box(&self.inner);
+ black_box(&self.meta);
+ }
+}
+
+criterion_group!(benches, bench);
+criterion_main!(benches);
diff --git a/vendor/tracing/benches/enter_span.rs b/vendor/tracing/benches/enter_span.rs
new file mode 100644
index 000000000..757350a53
--- /dev/null
+++ b/vendor/tracing/benches/enter_span.rs
@@ -0,0 +1,16 @@
+use criterion::{criterion_group, criterion_main, Criterion};
+use tracing::{span, Level};
+
+mod shared;
+
+fn bench(c: &mut Criterion) {
+ shared::for_all_dispatches(&mut c.benchmark_group("enter_span"), |b| {
+ let span = span!(Level::TRACE, "span");
+ b.iter(|| {
+ let _span = span.enter();
+ })
+ });
+}
+
+criterion_group!(benches, bench);
+criterion_main!(benches);
diff --git a/vendor/tracing/benches/event.rs b/vendor/tracing/benches/event.rs
new file mode 100644
index 000000000..164932548
--- /dev/null
+++ b/vendor/tracing/benches/event.rs
@@ -0,0 +1,12 @@
+use criterion::{criterion_group, criterion_main, Criterion};
+
+mod shared;
+
+fn bench(c: &mut Criterion) {
+ shared::for_all_recording(&mut c.benchmark_group("event"), |b| {
+ b.iter(|| tracing::info!("hello world!"))
+ });
+}
+
+criterion_group!(benches, bench);
+criterion_main!(benches);
diff --git a/vendor/tracing/benches/global_subscriber.rs b/vendor/tracing/benches/global_subscriber.rs
deleted file mode 100644
index 83519610a..000000000
--- a/vendor/tracing/benches/global_subscriber.rs
+++ /dev/null
@@ -1,136 +0,0 @@
-use std::fmt::Write;
-
-use criterion::{black_box, criterion_group, criterion_main, Criterion};
-use tracing::Level;
-
-use tracing::{span, Event, Id, Metadata};
-
-/// A subscriber that is enabled but otherwise does nothing.
-struct EnabledSubscriber;
-
-impl tracing::Subscriber for EnabledSubscriber {
- fn new_span(&self, span: &span::Attributes<'_>) -> Id {
- let _ = span;
- Id::from_u64(0xDEAD_FACE)
- }
-
- fn event(&self, event: &Event<'_>) {
- let _ = event;
- }
-
- fn record(&self, span: &Id, values: &span::Record<'_>) {
- let _ = (span, values);
- }
-
- fn record_follows_from(&self, span: &Id, follows: &Id) {
- let _ = (span, follows);
- }
-
- fn enabled(&self, metadata: &Metadata<'_>) -> bool {
- let _ = metadata;
- true
- }
-
- fn enter(&self, span: &Id) {
- let _ = span;
- }
-
- fn exit(&self, span: &Id) {
- let _ = span;
- }
-}
-
-const NOP_LOGGER: NopLogger = NopLogger;
-
-struct NopLogger;
-
-impl log::Log for NopLogger {
- fn enabled(&self, _metadata: &log::Metadata) -> bool {
- true
- }
-
- fn log(&self, record: &log::Record) {
- if self.enabled(record.metadata()) {
- let mut this = self;
- let _ = write!(this, "{}", record.args());
- }
- }
-
- fn flush(&self) {}
-}
-
-impl Write for &NopLogger {
- fn write_str(&mut self, s: &str) -> std::fmt::Result {
- black_box(s);
- Ok(())
- }
-}
-
-const N_SPANS: usize = 100;
-
-fn criterion_benchmark(c: &mut Criterion) {
- let mut c = c.benchmark_group("global/subscriber");
- let _ = tracing::subscriber::set_global_default(EnabledSubscriber);
- let _ = log::set_logger(&NOP_LOGGER);
- log::set_max_level(log::LevelFilter::Trace);
- c.bench_function("span_no_fields", |b| b.iter(|| span!(Level::TRACE, "span")));
-
- c.bench_function("event", |b| {
- b.iter(|| {
- tracing::event!(Level::TRACE, "hello");
- })
- });
-
- c.bench_function("enter_span", |b| {
- let span = span!(Level::TRACE, "span");
- #[allow(clippy::unit_arg)]
- b.iter(|| black_box(span.in_scope(|| {})))
- });
-
- c.bench_function("span_repeatedly", |b| {
- #[inline]
- fn mk_span(i: u64) -> tracing::Span {
- span!(Level::TRACE, "span", i = i)
- }
-
- let n = black_box(N_SPANS);
- b.iter(|| (0..n).fold(mk_span(0), |_, i| mk_span(i as u64)))
- });
-
- c.bench_function("span_with_fields", |b| {
- b.iter(|| {
- span!(
- Level::TRACE,
- "span",
- foo = "foo",
- bar = "bar",
- baz = 3,
- quuux = tracing::field::debug(0.99)
- )
- });
- });
-}
-
-fn bench_dispatch(c: &mut Criterion) {
- let mut group = c.benchmark_group("global/dispatch");
- let _ = tracing::subscriber::set_global_default(EnabledSubscriber);
- let _ = log::set_logger(&NOP_LOGGER);
- log::set_max_level(log::LevelFilter::Trace);
- group.bench_function("get_ref", |b| {
- b.iter(|| {
- tracing::dispatcher::get_default(|current| {
- black_box(&current);
- })
- })
- });
- group.bench_function("get_clone", |b| {
- b.iter(|| {
- let current = tracing::dispatcher::get_default(|current| current.clone());
- black_box(current);
- })
- });
- group.finish();
-}
-
-criterion_group!(benches, criterion_benchmark, bench_dispatch);
-criterion_main!(benches);
diff --git a/vendor/tracing/benches/no_subscriber.rs b/vendor/tracing/benches/no_subscriber.rs
deleted file mode 100644
index e0f82b56a..000000000
--- a/vendor/tracing/benches/no_subscriber.rs
+++ /dev/null
@@ -1,101 +0,0 @@
-use criterion::{black_box, criterion_group, criterion_main, Criterion};
-use tracing::Level;
-
-struct FakeEmptySpan {
- inner: Option<(usize, std::sync::Arc<()>)>,
- meta: Option<&'static ()>,
-}
-
-impl FakeEmptySpan {
- fn new() -> Self {
- Self {
- inner: None,
- meta: None,
- }
- }
-}
-
-impl Drop for FakeEmptySpan {
- fn drop(&mut self) {
- black_box(&self.inner);
- black_box(&self.meta);
- }
-}
-
-fn bench_no_subscriber(c: &mut Criterion) {
- use std::sync::atomic::{AtomicUsize, Ordering};
-
- let mut group = c.benchmark_group("no_subscriber");
-
- group.bench_function("span", |b| {
- b.iter(|| {
- let span = tracing::span!(Level::TRACE, "span");
- black_box(&span);
- })
- });
- group.bench_function("span_enter", |b| {
- b.iter(|| {
- let span = tracing::span!(Level::TRACE, "span");
- let _e = span.enter();
- })
- });
- group.bench_function("empty_span", |b| {
- b.iter(|| {
- let span = tracing::span::Span::none();
- black_box(&span);
- });
- });
- group.bench_function("empty_struct", |b| {
- b.iter(|| {
- let span = FakeEmptySpan::new();
- black_box(&span);
- })
- });
- group.bench_function("event", |b| {
- b.iter(|| {
- tracing::event!(Level::TRACE, "hello");
- })
- });
- group.bench_function("relaxed_load", |b| {
- let foo = AtomicUsize::new(1);
- b.iter(|| black_box(foo.load(Ordering::Relaxed)));
- });
- group.bench_function("acquire_load", |b| {
- let foo = AtomicUsize::new(1);
- b.iter(|| black_box(foo.load(Ordering::Acquire)))
- });
- group.bench_function("log", |b| {
- b.iter(|| {
- log::log!(log::Level::Info, "log");
- })
- });
- group.finish();
-}
-
-fn bench_fields(c: &mut Criterion) {
- let mut group = c.benchmark_group("no_subscriber_field");
- group.bench_function("span", |b| {
- b.iter(|| {
- black_box(tracing::span!(
- Level::TRACE,
- "span",
- foo = tracing::field::display(format!("bar {:?}", 2))
- ));
- })
- });
- group.bench_function("event", |b| {
- b.iter(|| {
- tracing::event!(
- Level::TRACE,
- foo = tracing::field::display(format!("bar {:?}", 2))
- );
- })
- });
- group.bench_function("log", |b| {
- b.iter(|| log::log!(log::Level::Trace, "{}", format!("bar {:?}", 2)))
- });
- group.finish();
-}
-
-criterion_group!(benches, bench_no_subscriber, bench_fields);
-criterion_main!(benches);
diff --git a/vendor/tracing/benches/shared.rs b/vendor/tracing/benches/shared.rs
new file mode 100644
index 000000000..56508c4ab
--- /dev/null
+++ b/vendor/tracing/benches/shared.rs
@@ -0,0 +1,160 @@
+#![allow(dead_code)]
+use criterion::{black_box, measurement::WallTime, Bencher};
+use tracing::{field, span, Event, Id, Metadata};
+
+use std::{
+ fmt::{self, Write},
+ sync::{Mutex, MutexGuard},
+};
+
+pub fn for_all_recording(
+ group: &mut criterion::BenchmarkGroup<'_, WallTime>,
+ mut iter: impl FnMut(&mut Bencher<'_, WallTime>),
+) {
+ // first, run benchmarks with no subscriber
+ group.bench_function("none", &mut iter);
+
+ // then, run benchmarks with a scoped default subscriber
+ tracing::subscriber::with_default(EnabledSubscriber, || {
+ group.bench_function("scoped", &mut iter)
+ });
+
+ let subscriber = VisitingSubscriber(Mutex::new(String::from("")));
+ tracing::subscriber::with_default(subscriber, || {
+ group.bench_function("scoped_recording", &mut iter);
+ });
+
+ // finally, set a global default subscriber, and run the benchmarks again.
+ tracing::subscriber::set_global_default(EnabledSubscriber)
+ .expect("global default should not have already been set!");
+ let _ = log::set_logger(&NOP_LOGGER);
+ log::set_max_level(log::LevelFilter::Trace);
+ group.bench_function("global", &mut iter);
+}
+
+pub fn for_all_dispatches(
+ group: &mut criterion::BenchmarkGroup<'_, WallTime>,
+ mut iter: impl FnMut(&mut Bencher<'_, WallTime>),
+) {
+ // first, run benchmarks with no subscriber
+ group.bench_function("none", &mut iter);
+
+ // then, run benchmarks with a scoped default subscriber
+ tracing::subscriber::with_default(EnabledSubscriber, || {
+ group.bench_function("scoped", &mut iter)
+ });
+
+ // finally, set a global default subscriber, and run the benchmarks again.
+ tracing::subscriber::set_global_default(EnabledSubscriber)
+ .expect("global default should not have already been set!");
+ let _ = log::set_logger(&NOP_LOGGER);
+ log::set_max_level(log::LevelFilter::Trace);
+ group.bench_function("global", &mut iter);
+}
+
+const NOP_LOGGER: NopLogger = NopLogger;
+
+struct NopLogger;
+
+impl log::Log for NopLogger {
+ fn enabled(&self, _metadata: &log::Metadata) -> bool {
+ true
+ }
+
+ fn log(&self, record: &log::Record) {
+ if self.enabled(record.metadata()) {
+ let mut this = self;
+ let _ = write!(this, "{}", record.args());
+ }
+ }
+
+ fn flush(&self) {}
+}
+
+impl Write for &NopLogger {
+ fn write_str(&mut self, s: &str) -> std::fmt::Result {
+ black_box(s);
+ Ok(())
+ }
+}
+
+/// Simulates a subscriber that records span data.
+struct VisitingSubscriber(Mutex<String>);
+
+struct Visitor<'a>(MutexGuard<'a, String>);
+
+impl<'a> field::Visit for Visitor<'a> {
+ fn record_debug(&mut self, _field: &field::Field, value: &dyn fmt::Debug) {
+ let _ = write!(&mut *self.0, "{:?}", value);
+ }
+}
+
+impl tracing::Subscriber for VisitingSubscriber {
+ fn new_span(&self, span: &span::Attributes<'_>) -> Id {
+ let mut visitor = Visitor(self.0.lock().unwrap());
+ span.record(&mut visitor);
+ Id::from_u64(0xDEAD_FACE)
+ }
+
+ fn record(&self, _span: &Id, values: &span::Record<'_>) {
+ let mut visitor = Visitor(self.0.lock().unwrap());
+ values.record(&mut visitor);
+ }
+
+ fn event(&self, event: &Event<'_>) {
+ let mut visitor = Visitor(self.0.lock().unwrap());
+ event.record(&mut visitor);
+ }
+
+ fn record_follows_from(&self, span: &Id, follows: &Id) {
+ let _ = (span, follows);
+ }
+
+ fn enabled(&self, metadata: &Metadata<'_>) -> bool {
+ let _ = metadata;
+ true
+ }
+
+ fn enter(&self, span: &Id) {
+ let _ = span;
+ }
+
+ fn exit(&self, span: &Id) {
+ let _ = span;
+ }
+}
+
+/// A subscriber that is enabled but otherwise does nothing.
+struct EnabledSubscriber;
+
+impl tracing::Subscriber for EnabledSubscriber {
+ fn new_span(&self, span: &span::Attributes<'_>) -> Id {
+ let _ = span;
+ Id::from_u64(0xDEAD_FACE)
+ }
+
+ fn event(&self, event: &Event<'_>) {
+ let _ = event;
+ }
+
+ fn record(&self, span: &Id, values: &span::Record<'_>) {
+ let _ = (span, values);
+ }
+
+ fn record_follows_from(&self, span: &Id, follows: &Id) {
+ let _ = (span, follows);
+ }
+
+ fn enabled(&self, metadata: &Metadata<'_>) -> bool {
+ let _ = metadata;
+ true
+ }
+
+ fn enter(&self, span: &Id) {
+ let _ = span;
+ }
+
+ fn exit(&self, span: &Id) {
+ let _ = span;
+ }
+}
diff --git a/vendor/tracing/benches/span_fields.rs b/vendor/tracing/benches/span_fields.rs
new file mode 100644
index 000000000..5ad828982
--- /dev/null
+++ b/vendor/tracing/benches/span_fields.rs
@@ -0,0 +1,23 @@
+use criterion::{criterion_group, criterion_main, Criterion};
+use tracing::{span, Level};
+
+mod shared;
+
+fn bench(c: &mut Criterion) {
+ shared::for_all_recording(&mut c.benchmark_group("span_fields"), |b| {
+ b.iter(|| {
+ let span = span!(
+ Level::TRACE,
+ "span",
+ foo = "foo",
+ bar = "bar",
+ baz = 3,
+ quuux = tracing::field::debug(0.99)
+ );
+ criterion::black_box(span)
+ })
+ });
+}
+
+criterion_group!(benches, bench);
+criterion_main!(benches);
diff --git a/vendor/tracing/benches/span_no_fields.rs b/vendor/tracing/benches/span_no_fields.rs
new file mode 100644
index 000000000..8a1ff6e04
--- /dev/null
+++ b/vendor/tracing/benches/span_no_fields.rs
@@ -0,0 +1,13 @@
+use criterion::{criterion_group, criterion_main, Criterion};
+use tracing::{span, Level};
+
+mod shared;
+
+fn bench(c: &mut Criterion) {
+ shared::for_all_recording(&mut c.benchmark_group("span_no_fields"), |b| {
+ b.iter(|| span!(Level::TRACE, "span"))
+ });
+}
+
+criterion_group!(benches, bench);
+criterion_main!(benches);
diff --git a/vendor/tracing/benches/span_repeated.rs b/vendor/tracing/benches/span_repeated.rs
new file mode 100644
index 000000000..4c6ac409d
--- /dev/null
+++ b/vendor/tracing/benches/span_repeated.rs
@@ -0,0 +1,20 @@
+use criterion::{black_box, criterion_group, criterion_main, Criterion};
+use tracing::{span, Level};
+
+mod shared;
+
+fn bench(c: &mut Criterion) {
+ shared::for_all_recording(&mut c.benchmark_group("span_repeated"), |b| {
+ let n = black_box(N_SPANS);
+ b.iter(|| (0..n).fold(mk_span(0), |_, i| mk_span(i as u64)))
+ });
+}
+
+#[inline]
+fn mk_span(i: u64) -> tracing::Span {
+ span!(Level::TRACE, "span", i = i)
+}
+
+const N_SPANS: usize = 100;
+criterion_group!(benches, bench);
+criterion_main!(benches);
diff --git a/vendor/tracing/benches/subscriber.rs b/vendor/tracing/benches/subscriber.rs
deleted file mode 100644
index c6418010f..000000000
--- a/vendor/tracing/benches/subscriber.rs
+++ /dev/null
@@ -1,189 +0,0 @@
-use criterion::{black_box, criterion_group, criterion_main, Criterion};
-use tracing::Level;
-
-use std::{
- fmt,
- sync::{Mutex, MutexGuard},
-};
-use tracing::{field, span, Event, Id, Metadata};
-
-/// A subscriber that is enabled but otherwise does nothing.
-struct EnabledSubscriber;
-
-impl tracing::Subscriber for EnabledSubscriber {
- fn new_span(&self, span: &span::Attributes<'_>) -> Id {
- let _ = span;
- Id::from_u64(0xDEAD_FACE)
- }
-
- fn event(&self, event: &Event<'_>) {
- let _ = event;
- }
-
- fn record(&self, span: &Id, values: &span::Record<'_>) {
- let _ = (span, values);
- }
-
- fn record_follows_from(&self, span: &Id, follows: &Id) {
- let _ = (span, follows);
- }
-
- fn enabled(&self, metadata: &Metadata<'_>) -> bool {
- let _ = metadata;
- true
- }
-
- fn enter(&self, span: &Id) {
- let _ = span;
- }
-
- fn exit(&self, span: &Id) {
- let _ = span;
- }
-}
-
-/// Simulates a subscriber that records span data.
-struct VisitingSubscriber(Mutex<String>);
-
-struct Visitor<'a>(MutexGuard<'a, String>);
-
-impl<'a> field::Visit for Visitor<'a> {
- fn record_debug(&mut self, _field: &field::Field, value: &dyn fmt::Debug) {
- use std::fmt::Write;
- let _ = write!(&mut *self.0, "{:?}", value);
- }
-}
-
-impl tracing::Subscriber for VisitingSubscriber {
- fn new_span(&self, span: &span::Attributes<'_>) -> Id {
- let mut visitor = Visitor(self.0.lock().unwrap());
- span.record(&mut visitor);
- Id::from_u64(0xDEAD_FACE)
- }
-
- fn record(&self, _span: &Id, values: &span::Record<'_>) {
- let mut visitor = Visitor(self.0.lock().unwrap());
- values.record(&mut visitor);
- }
-
- fn event(&self, event: &Event<'_>) {
- let mut visitor = Visitor(self.0.lock().unwrap());
- event.record(&mut visitor);
- }
-
- fn record_follows_from(&self, span: &Id, follows: &Id) {
- let _ = (span, follows);
- }
-
- fn enabled(&self, metadata: &Metadata<'_>) -> bool {
- let _ = metadata;
- true
- }
-
- fn enter(&self, span: &Id) {
- let _ = span;
- }
-
- fn exit(&self, span: &Id) {
- let _ = span;
- }
-}
-
-const N_SPANS: usize = 100;
-
-fn criterion_benchmark(c: &mut Criterion) {
- c.bench_function("span_no_fields", |b| {
- tracing::subscriber::with_default(EnabledSubscriber, || {
- b.iter(|| span!(Level::TRACE, "span"))
- });
- });
-
- c.bench_function("enter_span", |b| {
- tracing::subscriber::with_default(EnabledSubscriber, || {
- let span = span!(Level::TRACE, "span");
- #[allow(clippy::unit_arg)]
- b.iter(|| black_box(span.in_scope(|| {})))
- });
- });
-
- c.bench_function("span_repeatedly", |b| {
- #[inline]
- fn mk_span(i: u64) -> tracing::Span {
- span!(Level::TRACE, "span", i = i)
- }
-
- let n = black_box(N_SPANS);
- tracing::subscriber::with_default(EnabledSubscriber, || {
- b.iter(|| (0..n).fold(mk_span(0), |_, i| mk_span(i as u64)))
- });
- });
-
- c.bench_function("span_with_fields", |b| {
- tracing::subscriber::with_default(EnabledSubscriber, || {
- b.iter(|| {
- span!(
- Level::TRACE,
- "span",
- foo = "foo",
- bar = "bar",
- baz = 3,
- quuux = tracing::field::debug(0.99)
- )
- })
- });
- });
-
- c.bench_function("span_with_fields_record", |b| {
- let subscriber = VisitingSubscriber(Mutex::new(String::from("")));
- tracing::subscriber::with_default(subscriber, || {
- b.iter(|| {
- span!(
- Level::TRACE,
- "span",
- foo = "foo",
- bar = "bar",
- baz = 3,
- quuux = tracing::field::debug(0.99)
- )
- })
- });
- });
-}
-
-fn bench_dispatch(c: &mut Criterion) {
- let mut group = c.benchmark_group("dispatch");
- group.bench_function("no_dispatch_get_ref", |b| {
- b.iter(|| {
- tracing::dispatcher::get_default(|current| {
- black_box(&current);
- })
- })
- });
- group.bench_function("no_dispatch_get_clone", |b| {
- b.iter(|| {
- let current = tracing::dispatcher::get_default(|current| current.clone());
- black_box(current);
- })
- });
- group.bench_function("get_ref", |b| {
- tracing::subscriber::with_default(EnabledSubscriber, || {
- b.iter(|| {
- tracing::dispatcher::get_default(|current| {
- black_box(&current);
- })
- })
- })
- });
- group.bench_function("get_clone", |b| {
- tracing::subscriber::with_default(EnabledSubscriber, || {
- b.iter(|| {
- let current = tracing::dispatcher::get_default(|current| current.clone());
- black_box(current);
- })
- })
- });
- group.finish();
-}
-
-criterion_group!(benches, criterion_benchmark, bench_dispatch);
-criterion_main!(benches);
diff --git a/vendor/tracing/src/lib.rs b/vendor/tracing/src/lib.rs
index 4743eba20..7d60c7721 100644
--- a/vendor/tracing/src/lib.rs
+++ b/vendor/tracing/src/lib.rs
@@ -743,6 +743,7 @@
//! - [`tracing-forest`] provides a subscriber that preserves contextual coherence by
//! grouping together logs from the same spans during writing.
//! - [`tracing-loki`] provides a layer for shipping logs to [Grafana Loki].
+//! - [`tracing-logfmt`] provides a layer that formats events and spans into the logfmt format.
//!
//! If you're the maintainer of a `tracing` ecosystem crate not listed above,
//! please let us know! We'd love to add your project to the list!
@@ -779,6 +780,7 @@
//! [`tracing-forest`]: https://crates.io/crates/tracing-forest
//! [`tracing-loki`]: https://crates.io/crates/tracing-loki
//! [Grafana Loki]: https://grafana.com/oss/loki/
+//! [`tracing-logfmt`]: https://crates.io/crates/tracing-logfmt
//!
//! <pre class="ignore" style="white-space:normal;font:inherit;">
//! <strong>Note</strong>: Some of these ecosystem crates are currently
@@ -809,7 +811,7 @@
//!
//! ```toml
//! [dependencies]
-//! tracing = { version = "0.1.35", default-features = false }
+//! tracing = { version = "0.1.36", default-features = false }
//! ```
//!
//! <pre class="ignore" style="white-space:normal;font:inherit;">
@@ -892,7 +894,7 @@
//! [flags]: #crate-feature-flags
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(docsrs, feature(doc_cfg), deny(rustdoc::broken_intra_doc_links))]
-#![doc(html_root_url = "https://docs.rs/tracing/0.1.35")]
+#![doc(html_root_url = "https://docs.rs/tracing/0.1.36")]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png",
issue_tracker_base_url = "https://github.com/tokio-rs/tracing/issues/"
diff --git a/vendor/tracing/src/span.rs b/vendor/tracing/src/span.rs
index 21358eb27..58822f4d9 100644
--- a/vendor/tracing/src/span.rs
+++ b/vendor/tracing/src/span.rs
@@ -1136,7 +1136,7 @@ impl Span {
///
/// // Now, record a value for parting as well.
/// // (note that the field name is passed as a string slice)
- /// span.record("parting", &"goodbye world!");
+ /// span.record("parting", "goodbye world!");
/// ```
/// However, it may also be used to record a _new_ value for a field whose
/// value was already recorded:
@@ -1154,7 +1154,7 @@ impl Span {
/// }
/// Err(_) => {
/// // Things are no longer okay!
- /// span.record("is_okay", &false);
+ /// span.record("is_okay", false);
/// }
/// }
/// ```
@@ -1181,17 +1181,17 @@ impl Span {
/// // Now, you try to record a value for a new field, `new_field`, which was not
/// // declared as `Empty` or populated when you created `span`.
/// // You won't get any error, but the assignment will have no effect!
- /// span.record("new_field", &"interesting_value_you_really_need");
+ /// span.record("new_field", "interesting_value_you_really_need");
///
/// // Instead, all fields that may be recorded after span creation should be declared up front,
/// // using field::Empty when a value is not known, as we did for `parting`.
/// // This `record` call will indeed replace field::Empty with "you will be remembered".
- /// span.record("parting", &"you will be remembered");
+ /// span.record("parting", "you will be remembered");
/// ```
///
/// [`field::Empty`]: super::field::Empty
/// [`Metadata`]: super::Metadata
- pub fn record<Q: ?Sized, V>(&self, field: &Q, value: &V) -> &Self
+ pub fn record<Q: ?Sized, V>(&self, field: &Q, value: V) -> &Self
where
Q: field::AsField,
V: field::Value,
@@ -1201,7 +1201,7 @@ impl Span {
self.record_all(
&meta
.fields()
- .value_set(&[(&field, Some(value as &dyn field::Value))]),
+ .value_set(&[(&field, Some(&value as &dyn field::Value))]),
);
}
}
@@ -1614,4 +1614,10 @@ mod test {
impl AssertSync for Span {}
impl AssertSync for Entered<'_> {}
impl AssertSync for EnteredSpan {}
+
+ #[test]
+ fn test_record_backwards_compat() {
+ Span::current().record("some-key", &"some text");
+ Span::current().record("some-key", &false);
+ }
}
diff --git a/vendor/tracing/src/subscriber.rs b/vendor/tracing/src/subscriber.rs
index 343dc5914..f55698d13 100644
--- a/vendor/tracing/src/subscriber.rs
+++ b/vendor/tracing/src/subscriber.rs
@@ -5,12 +5,12 @@ pub use tracing_core::subscriber::*;
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
pub use tracing_core::dispatcher::DefaultGuard;
-/// Sets this subscriber as the default for the duration of a closure.
+/// Sets this [`Subscriber`] as the default for the current thread for the
+/// duration of a closure.
///
/// The default subscriber is used when creating a new [`Span`] or
-/// [`Event`], _if no span is currently executing_. If a span is currently
-/// executing, new spans or events are dispatched to the subscriber that
-/// tagged that span, instead.
+/// [`Event`].
+///
///
/// [`Span`]: super::span::Span
/// [`Subscriber`]: super::subscriber::Subscriber
@@ -43,13 +43,10 @@ where
crate::dispatcher::set_global_default(crate::Dispatch::new(subscriber))
}
-/// Sets the subscriber as the default for the duration of the lifetime of the
-/// returned [`DefaultGuard`]
+/// Sets the [`Subscriber`] as the default for the current thread for the
+/// duration of the lifetime of the returned [`DefaultGuard`].
///
-/// The default subscriber is used when creating a new [`Span`] or
-/// [`Event`], _if no span is currently executing_. If a span is currently
-/// executing, new spans or events are dispatched to the subscriber that
-/// tagged that span, instead.
+/// The default subscriber is used when creating a new [`Span`] or [`Event`].
///
/// [`Span`]: super::span::Span
/// [`Subscriber`]: super::subscriber::Subscriber
diff --git a/vendor/tracing/tests/event.rs b/vendor/tracing/tests/event.rs
index ffb63c816..61df19ad3 100644
--- a/vendor/tracing/tests/event.rs
+++ b/vendor/tracing/tests/event.rs
@@ -474,3 +474,27 @@ fn option_ref_mut_values() {
handle.assert_finished();
}
+
+#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
+#[test]
+fn string_field() {
+ let (subscriber, handle) = subscriber::mock()
+ .event(event::mock().with_fields(field::mock("my_string").with_value(&"hello").only()))
+ .event(
+ event::mock().with_fields(field::mock("my_string").with_value(&"hello world!").only()),
+ )
+ .done()
+ .run_with_handle();
+ with_default(subscriber, || {
+ let mut my_string = String::from("hello");
+
+ tracing::event!(Level::INFO, my_string);
+
+ // the string is not moved by using it as a field!
+ my_string.push_str(" world!");
+
+ tracing::event!(Level::INFO, my_string);
+ });
+
+ handle.assert_finished();
+}