From ac4a8dd27c0b28c36b9cf77cdc52b595168d1c5f Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Sat, 4 Sep 2021 11:29:14 -0700 Subject: [PATCH] chore: fix inconsistent terminology I noticed a handful of places where `v0.1.x` refers to `Subscriber`s as "collectors". This probably happened because we backported some commits from master and forgot to change every instance of "collector" back to "subscriber". This commit fixes that. Whoops. Signed-off-by: Eliza Weisman --- examples/examples/fmt-multiple-writers.rs | 2 +- examples/examples/fmt-pretty.rs | 2 +- examples/examples/fmt.rs | 2 +- tracing-opentelemetry/src/span_ext.rs | 6 +++--- tracing-subscriber/src/filter/env/mod.rs | 2 +- tracing-subscriber/src/fmt/mod.rs | 12 ++++++------ tracing/tests/span.rs | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/examples/examples/fmt-multiple-writers.rs b/examples/examples/fmt-multiple-writers.rs index cb05ebee5b..61ea4ac456 100644 --- a/examples/examples/fmt-multiple-writers.rs +++ b/examples/examples/fmt-multiple-writers.rs @@ -17,7 +17,7 @@ fn main() { .with(EnvFilter::from_default_env().add_directive(tracing::Level::TRACE.into())) .with(fmt::Layer::new().with_writer(io::stdout)) .with(fmt::Layer::new().with_writer(non_blocking)); - tracing::subscriber::set_global_default(subscriber).expect("Unable to set a global collector"); + tracing::subscriber::set_global_default(subscriber).expect("Unable to set a global subscriber"); let number_of_yaks = 3; // this creates a new event, outside of any spans. diff --git a/examples/examples/fmt-pretty.rs b/examples/examples/fmt-pretty.rs index 570b5fb71a..37bfaf15d9 100644 --- a/examples/examples/fmt-pretty.rs +++ b/examples/examples/fmt-pretty.rs @@ -8,7 +8,7 @@ fn main() { .with_thread_names(true) // enable everything .with_max_level(tracing::Level::TRACE) - // sets this to be the default, global collector for this application. + // sets this to be the default, global subscriber for this application. .init(); let number_of_yaks = 3; diff --git a/examples/examples/fmt.rs b/examples/examples/fmt.rs index a990821df4..a8b3848188 100644 --- a/examples/examples/fmt.rs +++ b/examples/examples/fmt.rs @@ -6,7 +6,7 @@ fn main() { tracing_subscriber::fmt() // enable everything .with_max_level(tracing::Level::TRACE) - // sets this to be the default, global collector for this application. + // sets this to be the default, global subscriber for this application. .init(); let number_of_yaks = 3; diff --git a/tracing-opentelemetry/src/span_ext.rs b/tracing-opentelemetry/src/span_ext.rs index 800c63335b..66753e4e7e 100644 --- a/tracing-opentelemetry/src/span_ext.rs +++ b/tracing-opentelemetry/src/span_ext.rs @@ -138,9 +138,9 @@ impl OpenTelemetrySpanExt for tracing::Span { if cx.is_valid() { let mut cx = Some(cx); let mut att = Some(attributes); - self.with_subscriber(move |(id, collector)| { - if let Some(get_context) = collector.downcast_ref::() { - get_context.with_context(collector, id, move |builder, _tracer| { + self.with_subscriber(move |(id, subscriber)| { + if let Some(get_context) = subscriber.downcast_ref::() { + get_context.with_context(subscriber, id, move |builder, _tracer| { if let Some(cx) = cx.take() { let attr = att.take().unwrap_or_default(); let follows_link = opentelemetry::trace::Link::new(cx, attr); diff --git a/tracing-subscriber/src/filter/env/mod.rs b/tracing-subscriber/src/filter/env/mod.rs index 42e5bd317a..c1293896c2 100644 --- a/tracing-subscriber/src/filter/env/mod.rs +++ b/tracing-subscriber/src/filter/env/mod.rs @@ -261,7 +261,7 @@ impl EnvFilter { #[cfg(feature = "ansi_term")] use ansi_term::{Color, Style}; // NOTE: We can't use a configured `MakeWriter` because the EnvFilter - // has no knowledge of any underlying subscriber or collector, which + // has no knowledge of any underlying subscriber or subscriber, which // may or may not use a `MakeWriter`. let warn = |msg: &str| { #[cfg(not(feature = "ansi_term"))] diff --git a/tracing-subscriber/src/fmt/mod.rs b/tracing-subscriber/src/fmt/mod.rs index 1bc8ef6fd2..9a759d0d75 100644 --- a/tracing-subscriber/src/fmt/mod.rs +++ b/tracing-subscriber/src/fmt/mod.rs @@ -27,7 +27,7 @@ //! //! ## Filtering Events with Environment Variables //! -//! The default collector installed by `init` enables you to filter events +//! The default subscriber installed by `init` enables you to filter events //! at runtime using environment variables (using the [`EnvFilter`]). //! //! The filter syntax is a superset of the [`env_logger`] syntax. @@ -52,7 +52,7 @@ //! You can create one by calling: //! //! ```rust -//! let collector = tracing_subscriber::fmt() +//! let subscriber = tracing_subscriber::fmt() //! // ... add configuration //! .finish(); //! ``` @@ -336,7 +336,7 @@ pub struct SubscriberBuilder< /// .with_target(false) /// .with_timer(tracing_subscriber::fmt::time::uptime()) /// .with_level(true) -/// // Set the collector as the default. +/// // Set the subscriber as the default. /// .init(); /// ``` /// @@ -347,11 +347,11 @@ pub struct SubscriberBuilder< /// /// fn init_subscriber() -> Result<(), Box> { /// tracing_subscriber::fmt() -/// // Configure the collector to emit logs in JSON format. +/// // Configure the subscriber to emit logs in JSON format. /// .json() -/// // Configure the collector to flatten event fields in the output JSON objects. +/// // Configure the subscriber to flatten event fields in the output JSON objects. /// .flatten_event(true) -/// // Set the collector as the default, returning an error if this fails. +/// // Set the subscriber as the default, returning an error if this fails. /// .try_init()?; /// /// Ok(()) diff --git a/tracing/tests/span.rs b/tracing/tests/span.rs index f7991931c5..c784a96069 100644 --- a/tracing/tests/span.rs +++ b/tracing/tests/span.rs @@ -461,7 +461,7 @@ fn move_field_out_of_struct() { #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)] #[test] fn float_values() { - let (collector, handle) = collector::mock() + let (subscriber, handle) = subscriber::mock() .new_span( span::mock().named("foo").with_field( field::mock("x") @@ -472,7 +472,7 @@ fn float_values() { ) .run_with_handle(); - with_default(collector, || { + with_default(subscriber, || { let foo = span!(Level::TRACE, "foo", x = 3.234, y = -1.223); foo.in_scope(|| {}); });