diff --git a/tracing-core/src/dispatcher.rs b/tracing-core/src/dispatcher.rs index d02eb0e790..61d5b0b73a 100644 --- a/tracing-core/src/dispatcher.rs +++ b/tracing-core/src/dispatcher.rs @@ -108,14 +108,13 @@ //! // `my_subscriber` is now the default //! ``` //! -//!
-//! Note:the thread-local scoped dispatcher -//! (with_default
) requires the -//! Rust standard library.no_std
users should use -//!set_global_default
-//! instead. -//!
with_default
) requires the
+//! Rust standard library. no_std
users should use
+//! set_global_default
+//! instead.
+//!
//!
//! ## Accessing the Default Subscriber
//!
@@ -208,12 +207,11 @@ pub struct DefaultGuard(Option-/// Note: This function required the Rust standard library. -///no_std
users should use -///set_global_default
instead. -///
no_std
users should use
+/// set_global_default
instead.
+///
///
/// [span]: ../span/index.html
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
@@ -233,12 +231,11 @@ pub fn with_default-/// Note: This function required the Rust standard library. -///no_std
users should use -///set_global_default
instead. -///
no_std
users should use
+/// set_global_default
instead.
+///
///
/// [`set_global_default`]: ../fn.set_global_default.html
#[cfg(feature = "std")]
@@ -258,12 +255,11 @@ pub fn set_default(dispatcher: &Dispatch) -> DefaultGuard {
/// Can only be set once; subsequent attempts to set the global default will fail.
/// Returns `Err` if the global default has already been set.
///
-///
-///
-/// Warning: In general, libraries should not call
-/// set_global_default()
! Doing so will cause conflicts when
-/// executables that depend on the library try to set the default later.
-///
+/// Warning: In general, libraries should not call
+/// set_global_default()
! Doing so will cause conflicts when
+/// executables that depend on the library try to set the default later.
+///
///
/// [span]: ../span/index.html
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
@@ -572,13 +568,14 @@ impl Dispatch {
/// must as well.
///
/// This calls the [`drop_span`] function on the [`Subscriber`] that this
- /// `Dispatch` forwards to.
+ /// `Dispatch` forwards to.
///
- /// - /// Deprecated: Thetry_close
- /// method is functionally identical, but returnstrue
if the span is now closed. - /// It should be used instead of this method. - ///
+ /// Deprecated: The/// /// [span ID]: ../span/struct.Id.html /// [`Subscriber`]: ../subscriber/trait.Subscriber.html diff --git a/tracing-core/src/metadata.rs b/tracing-core/src/metadata.rs index 5b9b5584f7..6a9f6de5fc 100644 --- a/tracing-core/src/metadata.rs +++ b/tracing-core/src/metadata.rs @@ -35,15 +35,15 @@ use crate::stdlib::{ /// _significantly_ lower than that of creating the actual span. Therefore, /// filtering is based on metadata, rather than on the constructed span. /// -///+ /// try_close
method is functionally identical, but returns + ///true
if the span is now closed. It should be used + /// instead of this method. + ///
-/// Note: Although instances ofMetadata
cannot -/// be compared directly, they provide a method -///id
, returning an opaque -/// callsite identifier which uniquely identifies the callsite where the metadata -/// originated. This can be used to determine if twoMetadata
correspond to -/// the same callsite. -///
Metadata
+/// cannot be compared directly, they provide a method
+/// id
, returning
+/// an opaque callsite
+/// identifierwhich uniquely identifies the callsite where the metadata
+/// originated. This can be used to determine if two Metadata
+/// correspond to the same callsite.
+///
///
/// [span]: ../span/index.html
/// [event]: ../event/index.html
diff --git a/tracing-core/src/span.rs b/tracing-core/src/span.rs
index b69d66c895..87e1b92533 100644
--- a/tracing-core/src/span.rs
+++ b/tracing-core/src/span.rs
@@ -61,9 +61,9 @@ enum CurrentInner {
impl Id {
/// Constructs a new span ID from the given `u64`.
///
- /// - /// Note: Span IDs must be greater than zero.
- /// Note: This requires the wrapped subscriber to implement the - ///LookupSpan
trait. - /// See the documentation onContext
's - /// declaration for details. - ///
+ /// LookupSpan
trait. See the documentation on
+ /// Context
's
+ /// declaration for details.
+ ///
#[inline]
pub fn event_span(&self, event: &Event<'_>) -> Option- /// Note: This requires the wrapped subscriber to implement the - ///LookupSpan
trait. - /// See the documentation onContext
's - /// declaration for details. - ///
+ /// LookupSpan
trait. See the documentation on
+ /// Context
's
+ /// declaration for details.
+ ///
///
/// [stored data]: ../registry/struct.SpanRef.html
#[inline]
@@ -248,13 +248,13 @@ where
/// Returns `true` if an active span exists for the given `Id`.
///
- /// - /// Note: This requires the wrapped subscriber to implement the - ///LookupSpan
trait. - /// See the documentation onContext
's - /// declaration for details. - ///
+ /// LookupSpan
trait. See the documentation on
+ /// Context
's
+ /// declaration for details.
+ ///
#[inline]
pub fn exists(&self, id: &span::Id) -> bool
where
@@ -268,13 +268,13 @@ where
///
/// If this returns `None`, then we are not currently within a span.
///
- /// - /// Note: This requires the wrapped subscriber to implement the - ///LookupSpan
trait. - /// See the documentation onContext
's - /// declaration for details. - ///
+ /// LookupSpan
trait. See the documentation on
+ /// Context
's
+ /// declaration for details.
+ ///
///
/// [stored data]: ../registry/struct.SpanRef.html
#[inline]
@@ -343,13 +343,13 @@ where
///
/// If this iterator is empty, then there are no spans in the current context.
///
- /// - /// Note: This requires the wrapped subscriber to implement the - ///LookupSpan
trait. - /// See the documentation onContext
's - /// declaration for details. - ///
+ /// LookupSpan
trait. See the documentation on
+ /// Context
's
+ /// declaration for details.
+ ///
///
/// [stored data]: ../registry/struct.SpanRef.html
#[deprecated(
@@ -375,27 +375,20 @@ where
/// current context, starting with the specified span and ending with the
/// root of the trace tree and ending with the current span.
///
- /// /// Note: Compared toscope
this /// returns the spans in reverse order (from leaf to root). Use ///Scope::from_root
/// in case root-to-leaf ordering is desired. - ///
- /// Note: This requires the wrapped subscriber to implement the - ///LookupSpan
trait. - /// See the documentation onContext
's - /// declaration for details. - ///
+ /// LookupSpan
trait. See the documentation on
+ /// Context
's
+ /// declaration for details.
+ ///
///
/// [stored data]: ../registry/struct.SpanRef.html
pub fn span_scope(&self, id: &span::Id) -> Option/// Note: Compared toscope
this /// returns the spans in reverse order (from leaf to root). Use ///Scope::from_root
/// in case root-to-leaf ordering is desired. - ///
- /// Note: This requires the wrapped subscriber to implement the - ///LookupSpan
trait. - /// See the documentation onContext
's - /// declaration for details. - ///
+ /// LookupSpan
trait. See the documentation on
+ /// Context
's
+ /// declaration for details.
+ ///
///
/// [stored data]: ../registry/struct.SpanRef.html
pub fn event_scope(&self, event: &Event<'_>) -> Option//! Warning: Currently, the //!Registry
type defined in this crate is the only root //!Subscriber
capable of supportingLayer
s with //! per-layer filters. In the future, new APIs will be added to allow other //! rootSubscriber
s to support per-layer filters. -//!
/// Note: This method (and ///Layer::enabled
) determine whether a span or event is @@ -496,7 +494,7 @@ where ///on_enter
, ///on_exit
, and other notification /// methods. - ///
/// Note: This method (and ///Layer::register_callsite
) determine whether a span or event is @@ -545,7 +542,7 @@ where ///on_enter
, ///on_exit
, and other notification /// methods. - ///
/// Note: If a- ///Filter
will perform /// dynamic filtering that depends on the current context in which @@ -842,7 +838,6 @@ pub trait Filter{ ///enabled
method may not be called when a particular instance /// of that span or event is recorded. ///
/// Note: users of theLookupSpan
trait should /// typically call thespan
method rather /// than this method. Thespan
method is implemented by /// callingspan_data
, but returns a reference which is /// capable of performing more sophisiticated queries. - ///
//! Note: The thread-local scoped dispatcher (with_default
) //! requires the Rust standard library.no_std
users should //! useset_global_default
//! instead. -//!
/// Note: Although this is implemented for both the
/// Field
type and any
diff --git a/tracing/src/lib.rs b/tracing/src/lib.rs
index 372536b100..ca5f93713f 100644
--- a/tracing/src/lib.rs
+++ b/tracing/src/lib.rs
@@ -51,13 +51,13 @@
//! The [`span` module][span]'s documentation provides further details on how to
//! use spans.
//!
-//!
+//!//! Warning: In asynchronous code that uses async/await syntax, //!Span::enter
may produce incorrect traces if the returned drop //! guard is held across an await point. See //! the method documentation //! for details. -//!
-//! Warning: In general, libraries should not call
-//! set_global_default()
! Doing so will cause conflicts when
-//! executables that depend on the library try to set the default later.
-//!
+//! Warning: In general, libraries should not call
+//! set_global_default()
! Doing so will cause conflicts when
+//! executables that depend on the library try to set the default later.
+//!
//!
//! This subscriber will be used as the default in all threads for the
//! remainder of the duration of the program, similar to setting the logger
@@ -767,12 +766,11 @@
//! [`tracing-elastic-apm`]: https://crates.io/crates/tracing-elastic-apm
//! [Elastic APM]: https://www.elastic.co/apm
//!
-//! -//! Note: Some of these ecosystem crates are currently -//! unreleased and/or in earlier stages of development. They may be less stable -//! thantracing
andtracing-core
. -//!
tracing
and tracing-core
.
+//!
//!
//! ## Crate Feature Flags
//!
@@ -800,14 +798,10 @@
//! tracing = { version = "0.1.27", default-features = false }
//! ```
//!
-//! -//! Note:tracing
'sno_std
support -//! requiresliballoc
. -//!
tracing
's no_std
support
+//! requires liballoc
.
+//!
//!
//! ## Supported Rust Versions
//!
diff --git a/tracing/src/span.rs b/tracing/src/span.rs
index c04ec07080..9a60d6f1c7 100644
--- a/tracing/src/span.rs
+++ b/tracing/src/span.rs
@@ -119,13 +119,12 @@
//! });
//! ```
//!
-//! -//! Note: Since entering a span takes&self
, and -//!Span
s areClone
,Send
, and -//!Sync
, it is entirely valid for multiple threads to enter the -//! same span concurrently. -//!
&self
, and
+//! Span
s are Clone
, Send
, and
+//! Sync
, it is entirely valid for multiple threads to enter the
+//! same span concurrently.
+//!
//!
//! ## Span Relationships
//!
@@ -649,7 +648,7 @@ impl Span {
/// // This is okay! The span has already been exited before we reach
/// // the await point.
/// some_other_async_function(some_value).await;
- ///
+ ///
/// // ...
/// }
/// ```
@@ -658,7 +657,7 @@ impl Span {
/// attaching a span to a future (async function or block). This will
/// enter the span _every_ time the future is polled, and exit it whenever
/// the future yields.
- ///
+ ///
/// `Instrument` can be used with an async block inside an async function:
/// ```ignore
/// # use tracing::info_span;
@@ -705,13 +704,13 @@ impl Span {
/// # async fn some_other_async_function() {}
/// #[tracing::instrument(level = "info")]
/// async fn my_async_function() {
- ///
+ ///
/// // This is correct! If we yield here, the span will be exited,
/// // and re-entered when we resume.
/// some_other_async_function().await;
///
/// // ...
- ///
+ ///
/// }
/// ```
///
@@ -789,6 +788,14 @@ impl Span {
/// Enters this span, consuming it and returning a [guard][`EnteredSpan`]
/// that will exit the span when dropped.
///
+ /// + /// Warning: In asynchronous code that uses async/await syntax, + ///+ /// + /// /// If this span is enabled by the current subscriber, then this function will /// call [`Subscriber::enter`] with the span's [`Id`], and dropping the guard /// will call [`Subscriber::exit`]. If the span is disabled, this does @@ -813,22 +820,13 @@ impl Span { /// Furthermore, `entered` may be used when the span must be stored in some /// other struct or be passed to a function while remaining entered. /// - ///Span::entered
may produce incorrect traces if the returned drop + /// guard is held across an await point. See the + ///Span::enter
documentation for details. + ///
- /// - /// **Note**: The returned [`EnteredSpan`] guard does not - /// implement `Send`. Dropping the guard will exit *this* span, - /// and if the guard is sent to another thread and dropped there, that thread may - /// never have entered this span. Thus, `EnteredSpan`s should not be sent - /// between threads. - /// - ///
EnteredSpan
guard does not implement Send
.
+ /// Dropping the guard will exit this span, and if the guard is sent
+ /// to another thread and dropped there, that thread may never have entered
+ /// this span. Thus, EnteredSpan
s should not be sent between threads.
+ ///
///
/// [syntax]: https://rust-lang.github.io/async-book/01_getting_started/04_async_await_primer.html
///
@@ -1159,14 +1157,15 @@ impl Span {
/// }
/// ```
///
- /// - /// Note: The fields associated with a span are part of its - ///Metadata
. - /// TheMetadata
. describing a particular - /// span is constructed statically when the span is created and cannot be extended later to - /// add new fields. Therefore, you cannot record a value for a field that was not specified - /// when the span was created:
Metadata
.
+ /// The Metadata
+ /// describing a particular span is constructed statically when the span
+ /// is created and cannot be extended later to add new fields. Therefore,
+ /// you cannot record a value for a field that was not specified when the
+ /// span was created:
+ ///
///
/// ```
/// use tracing::{trace_span, field};