docs: more intra-doc links (#2077)

* docs: `cargo intraconv` for more intra-doc links

... also it deleted some redundant ones, and it got some things wrong,
and it was gonna delete some of the cross-crate docs.rs links we can't
do as intra-doc links so I passed `--no-favored`.

* docs: convert https:// links to std/core/alloc to intra-doc links

Note that this adds some more broken intra doc links when building
without std support, but that was already a thing and I expect people
who build their own docs without std support can handle it.

This time I gave up on sed and used ruby.

    find -name '*.rs' -exec ruby -i -p blah.rb {} +

with

    $_.gsub!(%r{
        https://doc\.rust-lang\.org/
        (?: stable/)?
        ((?:core | std | alloc)(?:/\S+?)*)
        /(\w+)\.(\w+)\.html}x
    ) {
      path, kind, name = $~.captures
      suffix = case kind
        when 'method' then '()'
        when 'macro' then '!'
        else ''
      end
      r = [path.gsub('/', '::'), '::', name, suffix].join
      STDERR.puts [path, kind, name, suffix, r].inspect
      r
    }
    $_.gsub!(%r{
        https://doc\.rust-lang\.org/
        (?: stable/)?
        ((?: core | std | alloc)(?:/\S+?)*)
        /(?:
          index\.html
          | $
          | (?= \#)
         )}x
    ) {
      path, _ = $~.captures
      r = path.gsub('/', '::')
      STDERR.puts [path, r].inspect
      r
    }

* docs: more cross-crate intra-doc links

cargo intraconv doesn't seem to get them reliably and also plenty of
links to other crates aren't actually intra-doc because they're in
crates that don't depend (or only dev-depend, or only conditionally
depend) on those crates, so this wasn't very automated.

I tried to only convert docs.rs links to unconditional dependencies to
intra-crate links, but it's possible that some slipped through in either
direction.
This commit is contained in:
Benjamin Herr 2022-04-19 11:11:09 -07:00 committed by GitHub
parent 4f1e46306d
commit c8a2bb2d79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 176 additions and 263 deletions

View File

@ -89,12 +89,11 @@
//! The [`non_blocking` module][non_blocking]'s documentation provides more detail on how to use `non_blocking`. //! The [`non_blocking` module][non_blocking]'s documentation provides more detail on how to use `non_blocking`.
//! //!
//! [non_blocking]: mod@non_blocking //! [non_blocking]: mod@non_blocking
//! [write]: https://doc.rust-lang.org/std/io/trait.Write.html //! [write]: std::io::Write
//! [guard]: non_blocking::WorkerGuard //! [guard]: non_blocking::WorkerGuard
//! [rolling]: rolling //! [make_writer]: tracing_subscriber::fmt::MakeWriter
//! [make_writer]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/trait.MakeWriter.html
//! [rolling_struct]: rolling::RollingFileAppender //! [rolling_struct]: rolling::RollingFileAppender
//! [fmt_subscriber]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/struct.Subscriber.html //! [fmt_subscriber]: tracing_subscriber::fmt::Subscriber
//! //!
//! ## Non-Blocking Rolling File Appender //! ## Non-Blocking Rolling File Appender
//! //!

View File

@ -78,7 +78,6 @@ pub const DEFAULT_BUFFERED_LINES_LIMIT: usize = 128_000;
/// terminates abruptly (such as through an uncaught `panic` or a `std::process::exit`), some spans /// terminates abruptly (such as through an uncaught `panic` or a `std::process::exit`), some spans
/// or events may not be written. /// or events may not be written.
/// ///
/// [`NonBlocking`]: NonBlocking
/// Since spans/events and events recorded near a crash are often necessary for diagnosing the failure, /// Since spans/events and events recorded near a crash are often necessary for diagnosing the failure,
/// `WorkerGuard` provides a mechanism to ensure that _all_ buffered logs are flushed to their output. /// `WorkerGuard` provides a mechanism to ensure that _all_ buffered logs are flushed to their output.
/// `WorkerGuard` should be assigned in the `main` function or whatever the entrypoint of the program is. /// `WorkerGuard` should be assigned in the `main` function or whatever the entrypoint of the program is.
@ -121,8 +120,8 @@ pub struct WorkerGuard {
/// crate. Therefore, it can be used with the [`tracing_subscriber::fmt`][fmt] module /// crate. Therefore, it can be used with the [`tracing_subscriber::fmt`][fmt] module
/// or with any other subscriber/layer implementation that uses the `MakeWriter` trait. /// or with any other subscriber/layer implementation that uses the `MakeWriter` trait.
/// ///
/// [make_writer]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/trait.MakeWriter.html /// [make_writer]: tracing_subscriber::fmt::MakeWriter
/// [fmt]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/index.html /// [fmt]: mod@tracing_subscriber::fmt
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct NonBlocking { pub struct NonBlocking {
error_counter: ErrorCounter, error_counter: ErrorCounter,

View File

@ -17,10 +17,6 @@
//! will be created daily //! will be created daily
//! - [`Rotation::never()`][never()]: This will result in log file located at `some_directory/log_file_name` //! - [`Rotation::never()`][never()]: This will result in log file located at `some_directory/log_file_name`
//! //!
//! [minutely]: minutely
//! [hourly]: hourly
//! [daily]: daily
//! [never]: never
//! //!
//! # Examples //! # Examples
//! //!
@ -126,10 +122,6 @@ impl RollingFileAppender {
/// - [`Rotation::daily()`][daily], /// - [`Rotation::daily()`][daily],
/// - [`Rotation::never()`][never()] /// - [`Rotation::never()`][never()]
/// ///
/// [minutely]: minutely
/// [hourly]: hourly
/// [daily]: daily
/// [never]: never
/// ///
/// # Examples /// # Examples
/// ```rust /// ```rust

View File

@ -501,7 +501,7 @@ mod expand;
/// [`INFO`]: https://docs.rs/tracing/latest/tracing/struct.Level.html#associatedconstant.INFO /// [`INFO`]: https://docs.rs/tracing/latest/tracing/struct.Level.html#associatedconstant.INFO
/// [empty field]: https://docs.rs/tracing/latest/tracing/field/struct.Empty.html /// [empty field]: https://docs.rs/tracing/latest/tracing/field/struct.Empty.html
/// [field syntax]: https://docs.rs/tracing/latest/tracing/#recording-fields /// [field syntax]: https://docs.rs/tracing/latest/tracing/#recording-fields
/// [`fmt::Debug`]: https://doc.rust-lang.org/std/fmt/trait.Debug.html /// [`fmt::Debug`]: std::fmt::Debug
#[proc_macro_attribute] #[proc_macro_attribute]
pub fn instrument( pub fn instrument(
args: proc_macro::TokenStream, args: proc_macro::TokenStream,

View File

@ -123,11 +123,6 @@
//! currently default `Dispatch`. This is used primarily by `tracing` //! currently default `Dispatch`. This is used primarily by `tracing`
//! instrumentation. //! instrumentation.
//! //!
//! [`Subscriber`]: Subscriber
//! [`with_default`]: with_default
//! [`set_global_default`]: set_global_default
//! [`get_default`]: get_default
//! [`Dispatch`]: Dispatch
use crate::{ use crate::{
callsite, span, callsite, span,
subscriber::{self, NoSubscriber, Subscriber}, subscriber::{self, NoSubscriber, Subscriber},
@ -151,7 +146,6 @@ use crate::stdlib::{
/// `Dispatch` trace data to a [`Subscriber`]. /// `Dispatch` trace data to a [`Subscriber`].
/// ///
/// [`Subscriber`]: Subscriber
#[derive(Clone)] #[derive(Clone)]
pub struct Dispatch { pub struct Dispatch {
subscriber: Arc<dyn Subscriber + Send + Sync>, subscriber: Arc<dyn Subscriber + Send + Sync>,
@ -579,7 +573,7 @@ impl Dispatch {
/// [`Subscriber`]: super::subscriber::Subscriber /// [`Subscriber`]: super::subscriber::Subscriber
/// [`drop_span`]: super::subscriber::Subscriber::drop_span /// [`drop_span`]: super::subscriber::Subscriber::drop_span
/// [`new_span`]: super::subscriber::Subscriber::new_span /// [`new_span`]: super::subscriber::Subscriber::new_span
/// [`try_close`]: #method.try_close /// [`try_close`]: Entered::try_close()
#[inline] #[inline]
#[deprecated(since = "0.1.2", note = "use `Dispatch::try_close` instead")] #[deprecated(since = "0.1.2", note = "use `Dispatch::try_close` instead")]
pub fn drop_span(&self, id: span::Id) { pub fn drop_span(&self, id: span::Id) {

View File

@ -100,7 +100,6 @@
//! [`record_value`]: Visit::record_value //! [`record_value`]: Visit::record_value
//! [`record_debug`]: Visit::record_debug //! [`record_debug`]: Visit::record_debug
//! //!
//! [`Value`]: Value
//! [span]: super::span //! [span]: super::span
//! [`Event`]: super::event::Event //! [`Event`]: super::event::Event
//! [`Metadata`]: super::metadata::Metadata //! [`Metadata`]: super::metadata::Metadata
@ -110,7 +109,6 @@
//! [`record`]: super::subscriber::Subscriber::record //! [`record`]: super::subscriber::Subscriber::record
//! [`event`]: super::subscriber::Subscriber::event //! [`event`]: super::subscriber::Subscriber::event
//! [`Value::record`]: Value::record //! [`Value::record`]: Value::record
//! [`Visit`]: Visit
use crate::callsite; use crate::callsite;
use crate::stdlib::{ use crate::stdlib::{
borrow::Borrow, borrow::Borrow,
@ -249,13 +247,11 @@ pub struct Iter {
/// <code>std::error::Error</code> trait. /// <code>std::error::Error</code> trait.
/// </pre></div> /// </pre></div>
/// ///
/// [`Value`]: Value
/// [recorded]: Value::record /// [recorded]: Value::record
/// [`Subscriber`]: super::subscriber::Subscriber /// [`Subscriber`]: super::subscriber::Subscriber
/// [records an `Event`]: super::subscriber::Subscriber::event /// [records an `Event`]: super::subscriber::Subscriber::event
/// [set of `Value`s added to a `Span`]: super::subscriber::Subscriber::record /// [set of `Value`s added to a `Span`]: super::subscriber::Subscriber::record
/// [`Event`]: super::event::Event /// [`Event`]: super::event::Event
/// [`ValueSet`]: ValueSet
pub trait Visit { pub trait Visit {
/// Visits an arbitrary type implementing the [`valuable`] crate's `Valuable` trait. /// Visits an arbitrary type implementing the [`valuable`] crate's `Valuable` trait.
/// ///

View File

@ -47,13 +47,13 @@ use crate::stdlib::{
/// ///
/// [span]: super::span /// [span]: super::span
/// [event]: super::event /// [event]: super::event
/// [name]: #method.name /// [name]: Metadata::name()
/// [target]: #method.target /// [target]: Metadata::target()
/// [fields]: #method.fields /// [fields]: Metadata::fields()
/// [verbosity level]: #method.level /// [verbosity level]: Metadata::level()
/// [file name]: #method.file /// [file name]: Metadata::file()
/// [line number]: #method.line /// [line number]: Metadata::line()
/// [module path]: #method.module /// [module path]: Metadata::module_path()
/// [`Subscriber`]: super::subscriber::Subscriber /// [`Subscriber`]: super::subscriber::Subscriber
/// [`id`]: Metadata::id /// [`id`]: Metadata::id
/// [callsite identifier]: super::callsite::Identifier /// [callsite identifier]: super::callsite::Identifier
@ -604,8 +604,7 @@ impl LevelFilter {
/// Returns the most verbose [`Level`] that this filter accepts, or `None` /// Returns the most verbose [`Level`] that this filter accepts, or `None`
/// if it is [`OFF`]. /// if it is [`OFF`].
/// ///
/// [`Level`]: super::Level /// [`OFF`]: LevelFilter::OFF
/// [`OFF`]: #associatedconstant.OFF
pub const fn into_level(self) -> Option<Level> { pub const fn into_level(self) -> Option<Level> {
self.0 self.0
} }

View File

@ -39,7 +39,6 @@ pub struct Record<'a> {
/// - "some", with the current span's [`Id`] and [`Metadata`]. /// - "some", with the current span's [`Id`] and [`Metadata`].
/// ///
/// [the `Subscriber` considers]: super::subscriber::Subscriber::current_span /// [the `Subscriber` considers]: super::subscriber::Subscriber::current_span
/// [`Id`]: Id
/// [`Metadata`]: super::metadata::Metadata /// [`Metadata`]: super::metadata::Metadata
#[derive(Debug)] #[derive(Debug)]
pub struct Current { pub struct Current {
@ -73,7 +72,7 @@ impl Id {
/// Constructs a new span ID from the given `NonZeroU64`. /// Constructs a new span ID from the given `NonZeroU64`.
/// ///
/// Unlike [`Id::from_u64`](#method.from_u64), this will never panic. /// Unlike [`Id::from_u64`](Id::from_u64()), this will never panic.
#[inline] #[inline]
pub const fn from_non_zero_u64(id: NonZeroU64) -> Self { pub const fn from_non_zero_u64(id: NonZeroU64) -> Self {
Id(id) Id(id)
@ -273,9 +272,9 @@ impl Current {
/// `None`, but in this case, that is because the subscriber does not keep /// `None`, but in this case, that is because the subscriber does not keep
/// track of the currently-entered span. /// track of the currently-entered span.
/// ///
/// [`id`]: #method.id /// [`id`]: Current::id()
/// [`metadata`]: #method.metadata /// [`metadata`]: Current::metadata()
/// [`into_inner`]: #method.into_inner /// [`into_inner`]: Current::into_inner()
pub fn is_known(&self) -> bool { pub fn is_known(&self) -> bool {
!matches!(self.inner, CurrentInner::Unknown) !matches!(self.inner, CurrentInner::Unknown)
} }

View File

@ -67,7 +67,6 @@ use crate::stdlib::{
/// [ID]: super::span::Id /// [ID]: super::span::Id
/// [`new_span`]: Subscriber::new_span /// [`new_span`]: Subscriber::new_span
/// [`register_callsite`]: Subscriber::register_callsite /// [`register_callsite`]: Subscriber::register_callsite
/// [`Interest`]: Interest
/// [`enabled`]: Subscriber::enabled /// [`enabled`]: Subscriber::enabled
/// [`clone_span`]: Subscriber::clone_span /// [`clone_span`]: Subscriber::clone_span
/// [`try_close`]: Subscriber::try_close /// [`try_close`]: Subscriber::try_close
@ -136,10 +135,9 @@ pub trait Subscriber: 'static {
/// _may_ still see spans and events originating from that callsite, if /// _may_ still see spans and events originating from that callsite, if
/// another subscriber expressed interest in it. /// another subscriber expressed interest in it.
/// ///
/// [filter]: #method.enabled /// [filter]: Subscriber::enabled()
/// [metadata]: super::metadata::Metadata /// [metadata]: super::metadata::Metadata
/// [`Interest`]: Interest /// [`enabled`]: Subscriber::enabled()
/// [`enabled`]: #method.enabled
/// [`rebuild_interest_cache`]: super::callsite::rebuild_interest_cache /// [`rebuild_interest_cache`]: super::callsite::rebuild_interest_cache
fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest { fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest {
if self.enabled(metadata) { if self.enabled(metadata) {
@ -168,7 +166,7 @@ pub trait Subscriber: 'static {
/// [metadata]: super::metadata::Metadata /// [metadata]: super::metadata::Metadata
/// [interested]: Interest /// [interested]: Interest
/// [`Interest::sometimes`]: Interest::sometimes /// [`Interest::sometimes`]: Interest::sometimes
/// [`register_callsite`]: #method.register_callsite /// [`register_callsite`]: Subscriber::register_callsite()
fn enabled(&self, metadata: &Metadata<'_>) -> bool; fn enabled(&self, metadata: &Metadata<'_>) -> bool;
/// Returns the highest [verbosity level][level] that this `Subscriber` will /// Returns the highest [verbosity level][level] that this `Subscriber` will
@ -192,7 +190,6 @@ pub trait Subscriber: 'static {
/// level changes. /// level changes.
/// ///
/// [level]: super::Level /// [level]: super::Level
/// [`Interest`]: Interest
/// [rebuild]: super::callsite::rebuild_interest_cache /// [rebuild]: super::callsite::rebuild_interest_cache
fn max_level_hint(&self) -> Option<LevelFilter> { fn max_level_hint(&self) -> Option<LevelFilter> {
None None

View File

@ -53,14 +53,13 @@ use tracing::{Metadata, Span};
/// Additionally, if custom formatting is desired, the [`with_spans`] method can /// Additionally, if custom formatting is desired, the [`with_spans`] method can
/// be used to visit each span in the trace, formatting them in order. /// be used to visit each span in the trace, formatting them in order.
/// ///
/// [`tracing`]: https://docs.rs/tracing /// [`Backtrace`]: std::backtrace::Backtrace
/// [`Backtrace`]: https://doc.rust-lang.org/std/backtrace/struct.Backtrace.html /// [span]: mod@tracing::span
/// [span]: https://docs.rs/tracing/latest/tracing/span/index.html /// [parents]: mod@tracing::span#span-relationships
/// [parents]: https://docs.rs/tracing/latest/tracing/span/index.html#span-relationships /// [fields]: tracing::field
/// [fields]: https://docs.rs/tracing/latest/tracing/field/index.html /// [futures]: std::future::Future
/// [futures]: https://doc.rust-lang.org/std/future/trait.Future.html
/// [`tracing-futures`]: https://docs.rs/tracing-futures/ /// [`tracing-futures`]: https://docs.rs/tracing-futures/
/// [`with_spans`]: #method.with_spans /// [`with_spans`]: SpanTrace::with_spans()
#[derive(Clone)] #[derive(Clone)]
pub struct SpanTrace { pub struct SpanTrace {
span: Span, span: Span,
@ -114,8 +113,8 @@ impl SpanTrace {
/// indicate whether to continue iterating over spans; if it returns /// indicate whether to continue iterating over spans; if it returns
/// `false`, no additional spans will be visited. /// `false`, no additional spans will be visited.
/// ///
/// [fields]: https://docs.rs/tracing/latest/tracing/field/index.html /// [fields]: tracing::field
/// [`Metadata`]: https://docs.rs/tracing/latest/tracing/struct.Metadata.html /// [`Metadata`]: tracing::Metadata
pub fn with_spans(&self, f: impl FnMut(&'static Metadata<'static>, &str) -> bool) { pub fn with_spans(&self, f: impl FnMut(&'static Metadata<'static>, &str) -> bool) {
self.span.with_subscriber(|(id, s)| { self.span.with_subscriber(|(id, s)| {
if let Some(getcx) = s.downcast_ref::<WithContext>() { if let Some(getcx) = s.downcast_ref::<WithContext>() {

View File

@ -15,10 +15,10 @@ use tracing_subscriber::{
/// when formatting the fields of each span in a trace. When no formatter is /// when formatting the fields of each span in a trace. When no formatter is
/// provided, the [default format] is used instead. /// provided, the [default format] is used instead.
/// ///
/// [`Layer`]: https://docs.rs/tracing-subscriber/0.3/tracing_subscriber/layer/trait.Layer.html /// [`Layer`]: tracing_subscriber::layer::Layer
/// [`SpanTrace`]: super::SpanTrace /// [`SpanTrace`]: super::SpanTrace
/// [field formatter]: https://docs.rs/tracing-subscriber/0.3/tracing_subscriber/fmt/trait.FormatFields.html /// [field formatter]: tracing_subscriber::fmt::FormatFields
/// [default format]: https://docs.rs/tracing-subscriber/0.3/tracing_subscriber/fmt/format/struct.DefaultFields.html /// [default format]: tracing_subscriber::fmt::format::DefaultFields
pub struct ErrorLayer<S, F = DefaultFields> { pub struct ErrorLayer<S, F = DefaultFields> {
format: F, format: F,
@ -69,7 +69,7 @@ where
{ {
/// Returns a new `ErrorLayer` with the provided [field formatter]. /// Returns a new `ErrorLayer` with the provided [field formatter].
/// ///
/// [field formatter]: https://docs.rs/tracing-subscriber/0.2.10/tracing_subscriber/fmt/trait.FormatFields.html /// [field formatter]: tracing_subscriber::fmt::FormatFields
pub fn new(format: F) -> Self { pub fn new(format: F) -> Self {
Self { Self {
format, format,

View File

@ -157,19 +157,12 @@
//! } //! }
//! ``` //! ```
//! //!
//! [`SpanTrace`]: SpanTrace
//! [`ErrorLayer`]: ErrorLayer
//! [`TracedError`]: TracedError
//! [`InstrumentResult`]: InstrumentResult
//! [`InstrumentError`]: InstrumentError
//! [`ExtractSpanTrace`]: ExtractSpanTrace
//! [`in_current_span()`]: InstrumentResult#tymethod.in_current_span //! [`in_current_span()`]: InstrumentResult#tymethod.in_current_span
//! [span]: https://docs.rs/tracing/latest/tracing/span/index.html //! [span]: mod@tracing::span
//! [events]: https://docs.rs/tracing/latest/tracing/struct.Event.html //! [events]: tracing::Event
//! [`Subscriber`]: https://docs.rs/tracing/latest/tracing/trait.Subscriber.html //! [`Subscriber`]: tracing::Subscriber
//! [subscriber layer]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/layer/trait.Layer.html //! [subscriber layer]: tracing_subscriber::layer::Layer
//! [`tracing`]: https://docs.rs/tracing //! [`tracing`]: tracing
//! [`std::error::Error`]: https://doc.rust-lang.org/stable/std/error/trait.Error.html
//! //!
//! ## Supported Rust Versions //! ## Supported Rust Versions
//! //!

View File

@ -89,10 +89,7 @@
//! the execution of your program. This representation is best created with a //! the execution of your program. This representation is best created with a
//! _flamechart_, which _does not_ sort or collapse identical stack frames. //! _flamechart_, which _does not_ sort or collapse identical stack frames.
//! //!
//! [`tracing`]: https://docs.rs/tracing
//! [`inferno`]: https://docs.rs/inferno //! [`inferno`]: https://docs.rs/inferno
//! [`FlameLayer`]: FlameLayer
//! [`FlushGuard`]: FlushGuard
//! [`inferno-flamegraph`]: https://docs.rs/inferno/0.9.5/inferno/index.html#producing-a-flame-graph //! [`inferno-flamegraph`]: https://docs.rs/inferno/0.9.5/inferno/index.html#producing-a-flame-graph
//! //!
//! ## Supported Rust Versions //! ## Supported Rust Versions
@ -212,7 +209,6 @@ thread_local! {
/// flush the writer. /// flush the writer.
/// ///
/// [`flush_on_drop`]: FlameLayer::flush_on_drop /// [`flush_on_drop`]: FlameLayer::flush_on_drop
/// [`FlushGuard`]: FlushGuard
#[derive(Debug)] #[derive(Debug)]
pub struct FlameLayer<S, W> { pub struct FlameLayer<S, W> {
out: Arc<Mutex<W>>, out: Arc<Mutex<W>>,

View File

@ -52,11 +52,8 @@
//! //!
//! The `tokio`, `std-future` and `std` features are enabled by default. //! The `tokio`, `std-future` and `std` features are enabled by default.
//! //!
//! [`tracing`]: https://crates.io/crates/tracing //! [span]: tracing::span!
//! [span]: https://docs.rs/tracing/latest/tracing/span/index.html //! [`Subscriber`]: tracing::subscriber
//! [`Subscriber`]: https://docs.rs/tracing/latest/tracing/subscriber/index.html
//! [`Instrument`]: Instrument
//! [`WithSubscriber`]: WithSubscriber
//! [`futures`]: https://crates.io/crates/futures //! [`futures`]: https://crates.io/crates/futures
//! //!
//! ## Supported Rust Versions //! ## Supported Rust Versions
@ -121,7 +118,7 @@ pub mod executor;
/// Extension trait allowing futures, streams, sinks, and executors to be /// Extension trait allowing futures, streams, sinks, and executors to be
/// instrumented with a `tracing` [span]. /// instrumented with a `tracing` [span].
/// ///
/// [span]: https://docs.rs/tracing/latest/tracing/span/index.html /// [span]: mod@tracing::span
pub trait Instrument: Sized { pub trait Instrument: Sized {
/// Instruments this type with the provided `Span`, returning an /// Instruments this type with the provided `Span`, returning an
/// `Instrumented` wrapper. /// `Instrumented` wrapper.
@ -150,7 +147,7 @@ pub trait Instrument: Sized {
/// # } /// # }
/// ``` /// ```
/// ///
/// [entered]: https://docs.rs/tracing/latest/tracing/span/struct.Span.html#method.enter /// [entered]: tracing::Span::enter
fn instrument(self, span: Span) -> Instrumented<Self> { fn instrument(self, span: Span) -> Instrumented<Self> {
Instrumented { inner: self, span } Instrumented { inner: self, span }
} }
@ -185,8 +182,8 @@ pub trait Instrument: Sized {
/// # } /// # }
/// ``` /// ```
/// ///
/// [current]: https://docs.rs/tracing/latest/tracing/span/struct.Span.html#method.current /// [current]: tracing::Span::current
/// [entered]: https://docs.rs/tracing/latest/tracing/span/struct.Span.html#method.enter /// [entered]: tracing::Span::enter
#[inline] #[inline]
fn in_current_span(self) -> Instrumented<Self> { fn in_current_span(self) -> Instrumented<Self> {
self.instrument(Span::current()) self.instrument(Span::current())
@ -196,7 +193,7 @@ pub trait Instrument: Sized {
/// Extension trait allowing futures, streams, and sinks to be instrumented with /// Extension trait allowing futures, streams, and sinks to be instrumented with
/// a `tracing` [`Subscriber`]. /// a `tracing` [`Subscriber`].
/// ///
/// [`Subscriber`]: https://docs.rs/tracing/latest/tracing/subscriber/trait.Subscriber.html /// [`Subscriber`]: tracing::Subscriber
#[cfg(feature = "std")] #[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))] #[cfg_attr(docsrs, doc(cfg(feature = "std")))]
pub trait WithSubscriber: Sized { pub trait WithSubscriber: Sized {
@ -208,8 +205,8 @@ pub trait WithSubscriber: Sized {
/// When the wrapped type is an executor, the subscriber will be set as the /// When the wrapped type is an executor, the subscriber will be set as the
/// default for any futures spawned on that executor. /// default for any futures spawned on that executor.
/// ///
/// [`Subscriber`]: https://docs.rs/tracing/latest/tracing/subscriber/trait.Subscriber.html /// [`Subscriber`]: tracing::Subscriber
/// [default]: https://docs.rs/tracing/latest/tracing/dispatcher/index.html#setting-the-default-subscriber /// [default]: tracing::dispatcher#setting-the-default-subscriber
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where where
S: Into<Dispatch>, S: Into<Dispatch>,
@ -231,8 +228,8 @@ pub trait WithSubscriber: Sized {
/// This can be used to propagate the current dispatcher context when /// This can be used to propagate the current dispatcher context when
/// spawning a new future. /// spawning a new future.
/// ///
/// [`Subscriber`]: https://docs.rs/tracing/latest/tracing/subscriber/trait.Subscriber.html /// [`Subscriber`]: tracing::Subscriber
/// [default]: https://docs.rs/tracing/latest/tracing/dispatcher/index.html#setting-the-default-subscriber /// [default]: tracing::dispatcher#setting-the-default-subscriber
#[inline] #[inline]
fn with_current_subscriber(self) -> WithDispatch<Self> { fn with_current_subscriber(self) -> WithDispatch<Self> {
WithDispatch { WithDispatch {

View File

@ -7,7 +7,7 @@
//! //!
//! [`tracing`] is a framework for instrumenting Rust programs to collect //! [`tracing`] is a framework for instrumenting Rust programs to collect
//! scoped, structured, and async-aware diagnostics. `tracing-journald` provides a //! scoped, structured, and async-aware diagnostics. `tracing-journald` provides a
//! [`tracing-subscriber::Layer`][layer] implementation for logging `tracing` spans //! [`tracing-subscriber::Layer`] implementation for logging `tracing` spans
//! and events to [`systemd-journald`][journald], on Linux distributions that //! and events to [`systemd-journald`][journald], on Linux distributions that
//! use `systemd`. //! use `systemd`.
//! //!
@ -15,7 +15,6 @@
//! //!
//! [msrv]: #supported-rust-versions //! [msrv]: #supported-rust-versions
//! [`tracing`]: https://crates.io/crates/tracing //! [`tracing`]: https://crates.io/crates/tracing
//! [layer]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/layer/trait.Layer.html
//! [journald]: https://www.freedesktop.org/software/systemd/man/systemd-journald.service.html //! [journald]: https://www.freedesktop.org/software/systemd/man/systemd-journald.service.html
//! //!
//! ## Supported Rust Versions //! ## Supported Rust Versions

View File

@ -93,16 +93,8 @@
//! //!
//! [`init`]: LogTracer::init //! [`init`]: LogTracer::init
//! [`init_with_filter`]: LogTracer::init_with_filter //! [`init_with_filter`]: LogTracer::init_with_filter
//! [`AsTrace`]: AsTrace
//! [`AsLog`]: AsLog
//! [`LogTracer`]: LogTracer
//! [`TraceLogger`]: TraceLogger
//! [`env_logger`]: env_logger
//! [`tracing`]: https://crates.io/crates/tracing //! [`tracing`]: https://crates.io/crates/tracing
//! [`log`]: https://crates.io/crates/log
//! [`env_logger` crate]: https://crates.io/crates/env-logger //! [`env_logger` crate]: https://crates.io/crates/env-logger
//! [`log::Log`]: https://docs.rs/log/latest/log/trait.Log.html
//! [`log::Record`]: https://docs.rs/log/latest/log/struct.Record.html
//! [`tracing::Subscriber`]: https://docs.rs/tracing/latest/tracing/trait.Subscriber.html //! [`tracing::Subscriber`]: https://docs.rs/tracing/latest/tracing/trait.Subscriber.html
//! [`Subscriber`]: https://docs.rs/tracing/latest/tracing/trait.Subscriber.html //! [`Subscriber`]: https://docs.rs/tracing/latest/tracing/trait.Subscriber.html
//! [`tracing::Event`]: https://docs.rs/tracing/latest/tracing/struct.Event.html //! [`tracing::Event`]: https://docs.rs/tracing/latest/tracing/struct.Event.html
@ -488,8 +480,6 @@ impl AsLog for tracing_core::LevelFilter {
/// regardless of the source of its source. /// regardless of the source of its source.
/// ///
/// [`normalized_metadata`]: NormalizeEvent#normalized_metadata /// [`normalized_metadata`]: NormalizeEvent#normalized_metadata
/// [`AsTrace`]: AsTrace
/// [`log::Record`]: https://docs.rs/log/0.4.7/log/struct.Record.html
pub trait NormalizeEvent<'a>: crate::sealed::Sealed { pub trait NormalizeEvent<'a>: crate::sealed::Sealed {
/// If this `Event` comes from a `log`, this method provides a new /// If this `Event` comes from a `log`, this method provides a new
/// normalized `Metadata` which has all available attributes /// normalized `Metadata` which has all available attributes

View File

@ -93,7 +93,7 @@ impl LogTracer {
/// # } /// # }
/// ``` /// ```
/// ///
/// [`init`]: #method.init /// [`init`]: LogTracer::init()
/// [`init_with_filter`]: .#method.init_with_filter /// [`init_with_filter`]: .#method.init_with_filter
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {
@ -109,7 +109,7 @@ impl LogTracer {
/// The [`builder`] function can be used to customize the `LogTracer` before /// The [`builder`] function can be used to customize the `LogTracer` before
/// initializing it. /// initializing it.
/// ///
/// [`builder`]: #method.builder /// [`builder`]: LogTracer::builder()
#[cfg(feature = "std")] #[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))] #[cfg_attr(docsrs, doc(cfg(feature = "std")))]
pub fn init_with_filter(level: log::LevelFilter) -> Result<(), SetLoggerError> { pub fn init_with_filter(level: log::LevelFilter) -> Result<(), SetLoggerError> {
@ -143,8 +143,8 @@ impl LogTracer {
/// If you know in advance you want to filter some log levels, /// If you know in advance you want to filter some log levels,
/// use [`builder`] or [`init_with_filter`] instead. /// use [`builder`] or [`init_with_filter`] instead.
/// ///
/// [`init_with_filter`]: #method.init_with_filter /// [`init_with_filter`]: LogTracer::init_with_filter()
/// [`builder`]: #method.builder /// [`builder`]: LogTracer::builder()
#[cfg(feature = "std")] #[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))] #[cfg_attr(docsrs, doc(cfg(feature = "std")))]
pub fn init() -> Result<(), SetLoggerError> { pub fn init() -> Result<(), SetLoggerError> {
@ -208,7 +208,6 @@ impl log::Log for LogTracer {
impl Builder { impl Builder {
/// Returns a new `Builder` to construct a [`LogTracer`]. /// Returns a new `Builder` to construct a [`LogTracer`].
/// ///
/// [`LogTracer`]: LogTracer
pub fn new() -> Self { pub fn new() -> Self {
Self::default() Self::default()
} }

View File

@ -8,10 +8,9 @@
//! `tracing` events as `log` records, the ["log" and "log-always" feature //! `tracing` events as `log` records, the ["log" and "log-always" feature
//! flags][flags] on the `tracing` crate should be used instead. //! flags][flags] on the `tracing` crate should be used instead.
//! //!
//! [`log`]: https://docs.rs/log/0.4.8/log/index.html //! [`log`]: log
//! [`Subscriber`]: https://docs.rs/tracing/0.1.7/tracing/subscriber/trait.Subscriber.html //! [`Subscriber`]: https://docs.rs/tracing/0.1.7/tracing/subscriber/trait.Subscriber.html
//! [`TraceLogger`]: TraceLogger //! [`log::Record`]:log::Record
//! [`log::Record`]: https://docs.rs/log/0.4.8/log/struct.Record.html
//! [flags]: https://docs.rs/tracing/latest/tracing/#crate-feature-flags //! [flags]: https://docs.rs/tracing/latest/tracing/#crate-feature-flags
#![deprecated( #![deprecated(
since = "0.1.1", since = "0.1.1",
@ -53,7 +52,6 @@ thread_local! {
} }
/// Configures and constructs a [`TraceLogger`]. /// Configures and constructs a [`TraceLogger`].
/// ///
/// [`TraceLogger`]: TraceLogger
#[derive(Debug)] #[derive(Debug)]
pub struct Builder { pub struct Builder {
log_span_closes: bool, log_span_closes: bool,
@ -95,7 +93,6 @@ impl Builder {
/// Configures whether or not the [`TraceLogger`] being constructed will log /// Configures whether or not the [`TraceLogger`] being constructed will log
/// when a span closes. /// when a span closes.
/// ///
/// [`TraceLogger`]: TraceLogger
pub fn with_span_closes(self, log_span_closes: bool) -> Self { pub fn with_span_closes(self, log_span_closes: bool) -> Self {
Self { Self {
log_span_closes, log_span_closes,
@ -106,7 +103,6 @@ impl Builder {
/// Configures whether or not the [`TraceLogger`] being constructed will /// Configures whether or not the [`TraceLogger`] being constructed will
/// include the fields of parent spans when formatting events. /// include the fields of parent spans when formatting events.
/// ///
/// [`TraceLogger`]: TraceLogger
pub fn with_parent_fields(self, parent_fields: bool) -> Self { pub fn with_parent_fields(self, parent_fields: bool) -> Self {
Self { Self {
parent_fields, parent_fields,
@ -120,7 +116,6 @@ impl Builder {
/// If this is set to false, fields from the current span will still be /// If this is set to false, fields from the current span will still be
/// recorded as context, but the actual entry will not create a log record. /// recorded as context, but the actual entry will not create a log record.
/// ///
/// [`TraceLogger`]: TraceLogger
pub fn with_span_entry(self, log_enters: bool) -> Self { pub fn with_span_entry(self, log_enters: bool) -> Self {
Self { log_enters, ..self } Self { log_enters, ..self }
} }
@ -128,7 +123,6 @@ impl Builder {
/// Configures whether or not the [`TraceLogger`] being constructed will log /// Configures whether or not the [`TraceLogger`] being constructed will log
/// when a span is exited. /// when a span is exited.
/// ///
/// [`TraceLogger`]: TraceLogger
pub fn with_span_exits(self, log_exits: bool) -> Self { pub fn with_span_exits(self, log_exits: bool) -> Self {
Self { log_exits, ..self } Self { log_exits, ..self }
} }
@ -136,7 +130,6 @@ impl Builder {
/// Configures whether or not the [`TraceLogger`] being constructed will /// Configures whether or not the [`TraceLogger`] being constructed will
/// include span IDs when formatting log output. /// include span IDs when formatting log output.
/// ///
/// [`TraceLogger`]: TraceLogger
pub fn with_ids(self, log_ids: bool) -> Self { pub fn with_ids(self, log_ids: bool) -> Self {
Self { log_ids, ..self } Self { log_ids, ..self }
} }
@ -144,14 +137,12 @@ impl Builder {
/// Configures whether or not the [`TraceLogger`] being constructed will /// Configures whether or not the [`TraceLogger`] being constructed will
/// include the names of parent spans as context when formatting events. /// include the names of parent spans as context when formatting events.
/// ///
/// [`TraceLogger`]: TraceLogger
pub fn with_parent_names(self, log_parent: bool) -> Self { pub fn with_parent_names(self, log_parent: bool) -> Self {
Self { log_parent, ..self } Self { log_parent, ..self }
} }
/// Complete the builder, returning a configured [`TraceLogger`]. /// Complete the builder, returning a configured [`TraceLogger`].
/// ///
/// [`TraceLogger`]: TraceLogger
pub fn finish(self) -> TraceLogger { pub fn finish(self) -> TraceLogger {
TraceLogger::from_builder(self) TraceLogger::from_builder(self)
} }

View File

@ -26,8 +26,8 @@
//! * `otel.status_code`: Set the span status code to one of the supported OpenTelemetry [span status codes]. //! * `otel.status_code`: Set the span status code to one of the supported OpenTelemetry [span status codes].
//! * `otel.status_message`: Set the span status message. //! * `otel.status_message`: Set the span status message.
//! //!
//! [span kinds]: https://docs.rs/opentelemetry/latest/opentelemetry/trace/enum.SpanKind.html //! [span kinds]: opentelemetry::trace::SpanKind
//! [span status codes]: https://docs.rs/opentelemetry/latest/opentelemetry/trace/enum.StatusCode.html //! [span status codes]: opentelemetry::trace::StatusCode
//! //!
//! ### Semantic Conventions //! ### Semantic Conventions
//! //!

View File

@ -4,7 +4,7 @@ use opentelemetry::{trace::SpanContext, Context, KeyValue};
/// Utility functions to allow tracing [`Span`]s to accept and return /// Utility functions to allow tracing [`Span`]s to accept and return
/// [OpenTelemetry] [`Context`]s. /// [OpenTelemetry] [`Context`]s.
/// ///
/// [`Span`]: https://docs.rs/tracing/latest/tracing/struct.Span.html /// [`Span`]: tracing::Span
/// [OpenTelemetry]: https://opentelemetry.io /// [OpenTelemetry]: https://opentelemetry.io
/// [`Context`]: opentelemetry::Context /// [`Context`]: opentelemetry::Context
pub trait OpenTelemetrySpanExt { pub trait OpenTelemetrySpanExt {

View File

@ -53,7 +53,7 @@ impl<D, V> VisitDelimited<D, V> {
/// Returns a new [`Visit`] implementation that wraps `inner` so that /// Returns a new [`Visit`] implementation that wraps `inner` so that
/// each formatted field is separated by the provided `delimiter`. /// each formatted field is separated by the provided `delimiter`.
/// ///
/// [`Visit`]: https://docs.rs/tracing-core/0.1.6/tracing_core/field/trait.Visit.html /// [`Visit`]: tracing_core::field::Visit
pub fn new(delimiter: D, inner: V) -> Self { pub fn new(delimiter: D, inner: V) -> Self {
Self { Self {
delimiter, delimiter,

View File

@ -22,7 +22,7 @@ pub mod display;
/// data to, configuration variables that determine the visitor's behavior, or /// data to, configuration variables that determine the visitor's behavior, or
/// `()` when no input is required to produce a visitor. /// `()` when no input is required to produce a visitor.
/// ///
/// [visitors]: https://docs.rs/tracing-core/latest/tracing_core/field/trait.Visit.html /// [visitors]: tracing_core::field::Visit
pub trait MakeVisitor<T> { pub trait MakeVisitor<T> {
/// The visitor type produced by this `MakeVisitor`. /// The visitor type produced by this `MakeVisitor`.
type Visitor: Visit; type Visitor: Visit;
@ -33,7 +33,7 @@ pub trait MakeVisitor<T> {
/// A [visitor] that produces output once it has visited a set of fields. /// A [visitor] that produces output once it has visited a set of fields.
/// ///
/// [visitor]: https://docs.rs/tracing-core/latest/tracing_core/field/trait.Visit.html /// [visitor]: tracing_core::field::Visit
pub trait VisitOutput<Out>: Visit { pub trait VisitOutput<Out>: Visit {
/// Completes the visitor, returning any output. /// Completes the visitor, returning any output.
/// ///
@ -82,10 +82,10 @@ pub trait VisitOutput<Out>: Visit {
/// r.record(&mut visitor); /// r.record(&mut visitor);
/// } /// }
/// ``` /// ```
/// [visitor]: https://docs.rs/tracing-core/latest/tracing_core/field/trait.Visit.html /// [visitor]: tracing_core::field::Visit
/// [attr]: https://docs.rs/tracing-core/latest/tracing_core/span/struct.Attributes.html /// [attr]: tracing_core::span::Attributes
/// [rec]: https://docs.rs/tracing-core/latest/tracing_core/span/struct.Record.html /// [rec]: tracing_core::span::Record
/// [event]: https://docs.rs/tracing-core/latest/tracing_core/event/struct.Event.html /// [event]: tracing_core::event::Event
pub trait RecordFields: crate::sealed::Sealed<RecordFieldsMarker> { pub trait RecordFields: crate::sealed::Sealed<RecordFieldsMarker> {
/// Record all the fields in `self` with the provided `visitor`. /// Record all the fields in `self` with the provided `visitor`.
fn record(&self, visitor: &mut dyn Visit); fn record(&self, visitor: &mut dyn Visit);

View File

@ -224,8 +224,8 @@ impl EnvFilter {
/// `RUST_LOG` is the default environment variable used by /// `RUST_LOG` is the default environment variable used by
/// [`EnvFilter::from_default_env`] and [`EnvFilter::try_from_default_env`]. /// [`EnvFilter::from_default_env`] and [`EnvFilter::try_from_default_env`].
/// ///
/// [`EnvFilter::from_default_env`]: #method.from_default_env /// [`EnvFilter::from_default_env`]: EnvFilter::from_default_env()
/// [`EnvFilter::try_from_default_env`]: #method.try_from_default_env /// [`EnvFilter::try_from_default_env`]: EnvFilter::try_from_default_env()
pub const DEFAULT_ENV: &'static str = "RUST_LOG"; pub const DEFAULT_ENV: &'static str = "RUST_LOG";
// === constructors, etc === // === constructors, etc ===
@ -416,7 +416,7 @@ impl EnvFilter {
/// spans and events, the previous directive is overwritten. /// spans and events, the previous directive is overwritten.
/// ///
/// [`LevelFilter`]: super::LevelFilter /// [`LevelFilter`]: super::LevelFilter
/// [`Level`]: https://docs.rs/tracing-core/latest/tracing_core/struct.Level.html /// [`Level`]: tracing_core::Level
/// ///
/// # Examples /// # Examples
/// ///

View File

@ -393,7 +393,7 @@ where
/// `Layer`s added to this subscriber. /// `Layer`s added to this subscriber.
/// ///
/// [lifecycle]: https://docs.rs/tracing/latest/tracing/span/index.html#the-span-lifecycle /// [lifecycle]: https://docs.rs/tracing/latest/tracing/span/index.html#the-span-lifecycle
/// [time]: #method.without_time /// [time]: Layer::without_time()
pub fn with_span_events(self, kind: FmtSpan) -> Self { pub fn with_span_events(self, kind: FmtSpan) -> Self {
Layer { Layer {
fmt_span: self.fmt_span.with_kind(kind), fmt_span: self.fmt_span.with_kind(kind),
@ -444,7 +444,7 @@ where
/// Sets whether or not the [thread ID] of the current thread is displayed /// Sets whether or not the [thread ID] of the current thread is displayed
/// when formatting events /// when formatting events
/// ///
/// [thread ID]: https://doc.rust-lang.org/stable/std/thread/struct.ThreadId.html /// [thread ID]: std::thread::ThreadId
pub fn with_thread_ids(self, display_thread_ids: bool) -> Layer<S, N, format::Format<L, T>, W> { pub fn with_thread_ids(self, display_thread_ids: bool) -> Layer<S, N, format::Format<L, T>, W> {
Layer { Layer {
fmt_event: self.fmt_event.with_thread_ids(display_thread_ids), fmt_event: self.fmt_event.with_thread_ids(display_thread_ids),
@ -455,7 +455,7 @@ where
/// Sets whether or not the [name] of the current thread is displayed /// Sets whether or not the [name] of the current thread is displayed
/// when formatting events /// when formatting events
/// ///
/// [name]: https://doc.rust-lang.org/stable/std/thread/index.html#naming-threads /// [name]: std::thread#naming-threads
pub fn with_thread_names( pub fn with_thread_names(
self, self,
display_thread_names: bool, display_thread_names: bool,
@ -510,7 +510,7 @@ where
/// - [`Layer::flatten_event`] can be used to enable flattening event fields into the root /// - [`Layer::flatten_event`] can be used to enable flattening event fields into the root
/// object. /// object.
/// ///
/// [`Layer::flatten_event`]: #method.flatten_event /// [`Layer::flatten_event`]: Layer::flatten_event()
#[cfg(feature = "json")] #[cfg(feature = "json")]
#[cfg_attr(docsrs, doc(cfg(feature = "json")))] #[cfg_attr(docsrs, doc(cfg(feature = "json")))]
pub fn json(self) -> Layer<S, format::JsonFields, format::Format<format::Json, T>, W> { pub fn json(self) -> Layer<S, format::JsonFields, format::Format<format::Json, T>, W> {

View File

@ -80,9 +80,9 @@ use tracing_log::NormalizeEvent;
/// **Note**: This is an experimental feature. [Unstable features][unstable] /// **Note**: This is an experimental feature. [Unstable features][unstable]
/// must be enabled in order to use `valuable` support. /// must be enabled in order to use `valuable` support.
/// ///
/// [`Json::flatten_event`]: #method.flatten_event /// [`Json::flatten_event`]: Json::flatten_event()
/// [`Json::with_current_span`]: #method.with_current_span /// [`Json::with_current_span`]: Json::with_current_span()
/// [`Json::with_span_list`]: #method.with_span_list /// [`Json::with_span_list`]: Json::with_span_list()
/// [`valuable`]: https://crates.io/crates/valuable /// [`valuable`]: https://crates.io/crates/valuable
/// [unstable]: crate#unstable-features /// [unstable]: crate#unstable-features
/// [`valuable::Valuable`]: https://docs.rs/valuable/latest/valuable/trait.Valuable.html /// [`valuable::Valuable`]: https://docs.rs/valuable/latest/valuable/trait.Valuable.html
@ -341,7 +341,6 @@ impl Default for Json {
/// The JSON [`FormatFields`] implementation. /// The JSON [`FormatFields`] implementation.
/// ///
/// [`FormatFields`]: FormatFields
#[derive(Debug)] #[derive(Debug)]
pub struct JsonFields { pub struct JsonFields {
// reserve the ability to add fields to this without causing a breaking // reserve the ability to add fields to this without causing a breaking
@ -352,7 +351,6 @@ pub struct JsonFields {
impl JsonFields { impl JsonFields {
/// Returns a new JSON [`FormatFields`] implementation. /// Returns a new JSON [`FormatFields`] implementation.
/// ///
/// [`FormatFields`]: FormatFields
pub fn new() -> Self { pub fn new() -> Self {
Self { _private: () } Self { _private: () }
} }
@ -422,7 +420,6 @@ impl<'a> FormatFields<'a> for JsonFields {
/// The [visitor] produced by [`JsonFields`]'s [`MakeVisitor`] implementation. /// The [visitor] produced by [`JsonFields`]'s [`MakeVisitor`] implementation.
/// ///
/// [visitor]: crate::field::Visit /// [visitor]: crate::field::Visit
/// [`JsonFields`]: JsonFields
/// [`MakeVisitor`]: crate::field::MakeVisitor /// [`MakeVisitor`]: crate::field::MakeVisitor
pub struct JsonVisitor<'a> { pub struct JsonVisitor<'a> {
values: BTreeMap<&'a str, serde_json::Value>, values: BTreeMap<&'a str, serde_json::Value>,

View File

@ -281,7 +281,6 @@ pub fn json() -> Format<Json> {
/// Returns a [`FormatFields`] implementation that formats fields using the /// Returns a [`FormatFields`] implementation that formats fields using the
/// provided function or closure. /// provided function or closure.
/// ///
/// [`FormatFields`]: FormatFields
pub fn debug_fn<F>(f: F) -> FieldFn<F> pub fn debug_fn<F>(f: F) -> FieldFn<F>
where where
F: Fn(&mut Writer<'_>, &Field, &dyn fmt::Debug) -> fmt::Result + Clone, F: Fn(&mut Writer<'_>, &Field, &dyn fmt::Debug) -> fmt::Result + Clone,
@ -313,13 +312,11 @@ pub struct Writer<'writer> {
/// A [`FormatFields`] implementation that formats fields by calling a function /// A [`FormatFields`] implementation that formats fields by calling a function
/// or closure. /// or closure.
/// ///
/// [`FormatFields`]: FormatFields
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct FieldFn<F>(F); pub struct FieldFn<F>(F);
/// The [visitor] produced by [`FieldFn`]'s [`MakeVisitor`] implementation. /// The [visitor] produced by [`FieldFn`]'s [`MakeVisitor`] implementation.
/// ///
/// [visitor]: super::super::field::Visit /// [visitor]: super::super::field::Visit
/// [`FieldFn`]: FieldFn
/// [`MakeVisitor`]: super::super::field::MakeVisitor /// [`MakeVisitor`]: super::super::field::MakeVisitor
pub struct FieldFnVisitor<'a, F> { pub struct FieldFnVisitor<'a, F> {
f: F, f: F,
@ -664,8 +661,6 @@ impl<F, T> Format<F, T> {
/// ///
/// - [`Format::flatten_event`] can be used to enable flattening event fields into the root /// - [`Format::flatten_event`] can be used to enable flattening event fields into the root
/// object. /// object.
///
/// [`Format::flatten_event`]: #method.flatten_event
#[cfg(feature = "json")] #[cfg(feature = "json")]
#[cfg_attr(docsrs, doc(cfg(feature = "json")))] #[cfg_attr(docsrs, doc(cfg(feature = "json")))]
pub fn json(self) -> Format<Json, T> { pub fn json(self) -> Format<Json, T> {
@ -755,7 +750,7 @@ impl<F, T> Format<F, T> {
/// Sets whether or not the [thread ID] of the current thread is displayed /// Sets whether or not the [thread ID] of the current thread is displayed
/// when formatting events /// when formatting events
/// ///
/// [thread ID]: https://doc.rust-lang.org/stable/std/thread/struct.ThreadId.html /// [thread ID]: std::thread::ThreadId
pub fn with_thread_ids(self, display_thread_id: bool) -> Format<F, T> { pub fn with_thread_ids(self, display_thread_id: bool) -> Format<F, T> {
Format { Format {
display_thread_id, display_thread_id,
@ -766,7 +761,7 @@ impl<F, T> Format<F, T> {
/// Sets whether or not the [name] of the current thread is displayed /// Sets whether or not the [name] of the current thread is displayed
/// when formatting events /// when formatting events
/// ///
/// [name]: https://doc.rust-lang.org/stable/std/thread/index.html#naming-threads /// [name]: std::thread#naming-threads
pub fn with_thread_names(self, display_thread_name: bool) -> Format<F, T> { pub fn with_thread_names(self, display_thread_name: bool) -> Format<F, T> {
Format { Format {
display_thread_name, display_thread_name,
@ -1157,7 +1152,6 @@ where
/// The default [`FormatFields`] implementation. /// The default [`FormatFields`] implementation.
/// ///
/// [`FormatFields`]: FormatFields
#[derive(Debug)] #[derive(Debug)]
pub struct DefaultFields { pub struct DefaultFields {
// reserve the ability to add fields to this without causing a breaking // reserve the ability to add fields to this without causing a breaking
@ -1179,7 +1173,6 @@ pub struct DefaultVisitor<'a> {
impl DefaultFields { impl DefaultFields {
/// Returns a new default [`FormatFields`] implementation. /// Returns a new default [`FormatFields`] implementation.
/// ///
/// [`FormatFields`]: FormatFields
pub fn new() -> Self { pub fn new() -> Self {
Self { _private: () } Self { _private: () }
} }

View File

@ -184,7 +184,6 @@
//! [`EnvFilter`]: super::filter::EnvFilter //! [`EnvFilter`]: super::filter::EnvFilter
//! [`env_logger`]: https://docs.rs/env_logger/ //! [`env_logger`]: https://docs.rs/env_logger/
//! [`filter`]: super::filter //! [`filter`]: super::filter
//! [`SubscriberBuilder`]: SubscriberBuilder
//! [`FmtSubscriber`]: Subscriber //! [`FmtSubscriber`]: Subscriber
//! [`Subscriber`]: //! [`Subscriber`]:
//! https://docs.rs/tracing/latest/tracing/trait.Subscriber.html //! https://docs.rs/tracing/latest/tracing/trait.Subscriber.html
@ -341,7 +340,7 @@ impl Subscriber {
/// ///
/// This can be overridden with the [`SubscriberBuilder::with_max_level`] method. /// This can be overridden with the [`SubscriberBuilder::with_max_level`] method.
/// ///
/// [verbosity level]: https://docs.rs/tracing-core/0.1.5/tracing_core/struct.Level.html /// [verbosity level]: tracing_core::Level
/// [`SubscriberBuilder::with_max_level`]: SubscriberBuilder::with_max_level /// [`SubscriberBuilder::with_max_level`]: SubscriberBuilder::with_max_level
pub const DEFAULT_MAX_LEVEL: LevelFilter = LevelFilter::INFO; pub const DEFAULT_MAX_LEVEL: LevelFilter = LevelFilter::INFO;
@ -598,7 +597,7 @@ where
/// `Layer`s added to this subscriber. /// `Layer`s added to this subscriber.
/// ///
/// [lifecycle]: https://docs.rs/tracing/latest/tracing/span/index.html#the-span-lifecycle /// [lifecycle]: https://docs.rs/tracing/latest/tracing/span/index.html#the-span-lifecycle
/// [time]: #method.without_time /// [time]: SubscriberBuilder::without_time()
pub fn with_span_events(self, kind: format::FmtSpan) -> Self { pub fn with_span_events(self, kind: format::FmtSpan) -> Self {
SubscriberBuilder { SubscriberBuilder {
inner: self.inner.with_span_events(kind), inner: self.inner.with_span_events(kind),
@ -669,7 +668,7 @@ where
/// Sets whether or not the [name] of the current thread is displayed /// Sets whether or not the [name] of the current thread is displayed
/// when formatting events /// when formatting events
/// ///
/// [name]: https://doc.rust-lang.org/stable/std/thread/index.html#naming-threads /// [name]: std::thread#naming-threads
pub fn with_thread_names( pub fn with_thread_names(
self, self,
display_thread_names: bool, display_thread_names: bool,
@ -683,7 +682,7 @@ where
/// Sets whether or not the [thread ID] of the current thread is displayed /// Sets whether or not the [thread ID] of the current thread is displayed
/// when formatting events /// when formatting events
/// ///
/// [thread ID]: https://doc.rust-lang.org/stable/std/thread/struct.ThreadId.html /// [thread ID]: std::thread::ThreadId
pub fn with_thread_ids( pub fn with_thread_ids(
self, self,
display_thread_ids: bool, display_thread_ids: bool,
@ -893,7 +892,7 @@ impl<N, E, F, W> SubscriberBuilder<N, E, F, W> {
/// # Ok(())} /// # Ok(())}
/// ``` /// ```
/// [`EnvFilter`]: super::filter::EnvFilter /// [`EnvFilter`]: super::filter::EnvFilter
/// [`with_max_level`]: #method.with_max_level /// [`with_max_level`]: SubscriberBuilder::with_max_level()
#[cfg(feature = "env-filter")] #[cfg(feature = "env-filter")]
#[cfg_attr(docsrs, doc(cfg(feature = "env-filter")))] #[cfg_attr(docsrs, doc(cfg(feature = "env-filter")))]
pub fn with_env_filter( pub fn with_env_filter(
@ -936,7 +935,7 @@ impl<N, E, F, W> SubscriberBuilder<N, E, F, W> {
/// .with_max_level(LevelFilter::OFF) /// .with_max_level(LevelFilter::OFF)
/// .finish(); /// .finish();
/// ``` /// ```
/// [verbosity level]: https://docs.rs/tracing-core/0.1.5/tracing_core/struct.Level.html /// [verbosity level]: tracing_core::Level
/// [`EnvFilter`]: struct@crate::filter::EnvFilter /// [`EnvFilter`]: struct@crate::filter::EnvFilter
/// [`with_env_filter`]: fn@Self::with_env_filter /// [`with_env_filter`]: fn@Self::with_env_filter
pub fn with_max_level( pub fn with_max_level(

View File

@ -19,10 +19,10 @@ use time::{format_description::well_known, formatting::Formattable, OffsetDateTi
/// documentation</a> for more details. /// documentation</a> for more details.
/// </pre></div> /// </pre></div>
/// ///
/// [local time]: https://docs.rs/time/0.3/time/struct.OffsetDateTime.html#method.now_local /// [local time]: time::OffsetDateTime::now_local
/// [UTC time]: https://docs.rs/time/0.3/time/struct.OffsetDateTime.html#method.now_utc /// [UTC time]: time::OffsetDateTime::now_utc
/// [formatter]: https://docs.rs/time/0.3/time/formatting/trait.Formattable.html /// [formatter]: time::formatting::Formattable
/// [`time` crate]: https://docs.rs/time/0.3/time/ /// [`time` crate]: time
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[cfg_attr( #[cfg_attr(
docsrs, docsrs,
@ -37,10 +37,10 @@ pub struct LocalTime<F> {
/// ///
/// To format the current [local time] instead, use the [`LocalTime`] type. /// To format the current [local time] instead, use the [`LocalTime`] type.
/// ///
/// [local time]: https://docs.rs/time/0.3/time/struct.OffsetDateTime.html#method.now_local /// [local time]: time::OffsetDateTime::now_local
/// [UTC time]: https://docs.rs/time/0.3/time/struct.OffsetDateTime.html#method.now_utc /// [UTC time]: time::OffsetDateTime::now_utc
/// [formatter]: https://docs.rs/time/0.3/time/formatting/trait.Formattable.html /// [formatter]: time::formatting::Formattable
/// [`time` crate]: https://docs.rs/time/0.3/time/ /// [`time` crate]: time
#[cfg_attr(docsrs, doc(cfg(feature = "time")))] #[cfg_attr(docsrs, doc(cfg(feature = "time")))]
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct UtcTime<F> { pub struct UtcTime<F> {
@ -55,8 +55,8 @@ pub struct UtcTime<F> {
/// handle any errors. However, this also means the offset cannot change while the program is /// handle any errors. However, this also means the offset cannot change while the program is
/// running (the offset will not change across DST changes). /// running (the offset will not change across DST changes).
/// ///
/// [formatter]: https://docs.rs/time/0.3/time/formatting/trait.Formattable.html /// [formatter]: time::formatting::Formattable
/// [`time` crate]: https://docs.rs/time/0.3/time/ /// [`time` crate]: time
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[cfg_attr(docsrs, doc(cfg(feature = "time")))] #[cfg_attr(docsrs, doc(cfg(feature = "time")))]
pub struct OffsetTime<F> { pub struct OffsetTime<F> {
@ -81,7 +81,7 @@ impl LocalTime<well_known::Rfc3339> {
/// # drop(collector); /// # drop(collector);
/// ``` /// ```
/// ///
/// [local time]: https://docs.rs/time/0.3/time/struct.OffsetDateTime.html#method.now_local /// [local time]: time::OffsetDateTime::now_local
/// [RFC 3339]: https://datatracker.ietf.org/doc/html/rfc3339 /// [RFC 3339]: https://datatracker.ietf.org/doc/html/rfc3339
/// [ISO 8601]: https://en.wikipedia.org/wiki/ISO_8601 /// [ISO 8601]: https://en.wikipedia.org/wiki/ISO_8601
pub fn rfc_3339() -> Self { pub fn rfc_3339() -> Self {
@ -163,12 +163,12 @@ impl<F: Formattable> LocalTime<F> {
/// # drop(collector); /// # drop(collector);
/// ``` /// ```
/// ///
/// [local time]: https://docs.rs/time/latest/time/struct.OffsetDateTime.html#method.now_local /// [local time]: time::OffsetDateTime::now_local()
/// [`time` crate]: https://docs.rs/time/0.3/time/ /// [`time` crate]: time
/// [`Formattable`]: https://docs.rs/time/0.3/time/formatting/trait.Formattable.html /// [`Formattable`]: time::formatting::Formattable
/// [well-known formats]: https://docs.rs/time/0.3/time/format_description/well_known/index.html /// [well-known formats]: time::format_description::well_known
/// [`format_description!`]: https://docs.rs/time/0.3/time/macros/macro.format_description.html /// [`format_description!`]: time::macros::format_description!
/// [`time::format_description::parse`]: https://docs.rs/time/0.3/time/format_description/fn.parse.html /// [`time::format_description::parse`]: time::format_description::parse()
/// [`time` book]: https://time-rs.github.io/book/api/format-description.html /// [`time` book]: https://time-rs.github.io/book/api/format-description.html
pub fn new(format: F) -> Self { pub fn new(format: F) -> Self {
Self { format } Self { format }
@ -212,7 +212,7 @@ impl UtcTime<well_known::Rfc3339> {
/// # drop(collector); /// # drop(collector);
/// ``` /// ```
/// ///
/// [local time]: https://docs.rs/time/0.3/time/struct.OffsetDateTime.html#method.now_utc /// [local time]: time::OffsetDateTime::now_utc
/// [RFC 3339]: https://datatracker.ietf.org/doc/html/rfc3339 /// [RFC 3339]: https://datatracker.ietf.org/doc/html/rfc3339
/// [ISO 8601]: https://en.wikipedia.org/wiki/ISO_8601 /// [ISO 8601]: https://en.wikipedia.org/wiki/ISO_8601
pub fn rfc_3339() -> Self { pub fn rfc_3339() -> Self {
@ -280,12 +280,12 @@ impl<F: Formattable> UtcTime<F> {
/// # drop(collector); /// # drop(collector);
/// ``` /// ```
/// ///
/// [UTC time]: https://docs.rs/time/latest/time/struct.OffsetDateTime.html#method.now_utc /// [UTC time]: time::OffsetDateTime::now_utc()
/// [`time` crate]: https://docs.rs/time/0.3/time/ /// [`time` crate]: time
/// [`Formattable`]: https://docs.rs/time/0.3/time/formatting/trait.Formattable.html /// [`Formattable`]: time::formatting::Formattable
/// [well-known formats]: https://docs.rs/time/0.3/time/format_description/well_known/index.html /// [well-known formats]: time::format_description::well_known
/// [`format_description!`]: https://docs.rs/time/0.3/time/macros/macro.format_description.html /// [`format_description!`]: time::macros::format_description!
/// [`time::format_description::parse`]: https://docs.rs/time/0.3/time/format_description/fn.parse.html /// [`time::format_description::parse`]: time::format_description::parse
/// [`time` book]: https://time-rs.github.io/book/api/format-description.html /// [`time` book]: https://time-rs.github.io/book/api/format-description.html
pub fn new(format: F) -> Self { pub fn new(format: F) -> Self {
Self { format } Self { format }
@ -357,7 +357,7 @@ impl OffsetTime<well_known::Rfc3339> {
/// } /// }
/// ``` /// ```
/// ///
/// [local time offset]: https://docs.rs/time/0.3/time/struct.UtcOffset.html#method.current_local_offset /// [local time offset]: time::UtcOffset::current_local_offset
/// [RFC 3339]: https://datatracker.ietf.org/doc/html/rfc3339 /// [RFC 3339]: https://datatracker.ietf.org/doc/html/rfc3339
/// [ISO 8601]: https://en.wikipedia.org/wiki/ISO_8601 /// [ISO 8601]: https://en.wikipedia.org/wiki/ISO_8601
pub fn local_rfc_3339() -> Result<Self, time::error::IndeterminateOffset> { pub fn local_rfc_3339() -> Result<Self, time::error::IndeterminateOffset> {
@ -435,13 +435,13 @@ impl<F: time::formatting::Formattable> OffsetTime<F> {
/// # drop(collector); /// # drop(collector);
/// ``` /// ```
/// ///
/// [`time` crate]: https://docs.rs/time/0.3/time/ /// [`time` crate]: time
/// [timezone offset]: https://docs.rs/time/latest/time/struct.UtcOffset.html /// [timezone offset]: time::UtcOffset
/// [`Formattable`]: https://docs.rs/time/0.3/time/formatting/trait.Formattable.html /// [`Formattable`]: time::formatting::Formattable
/// [local offset]: https://docs.rs/time/0.3.5/time/struct.UtcOffset.html#method.current_local_offset /// [local offset]: time::UtcOffset::current_local_offset()
/// [well-known formats]: https://docs.rs/time/0.3/time/format_description/well_known/index.html /// [well-known formats]: time::format_description::well_known
/// [`format_description!`]: https://docs.rs/time/0.3/time/macros/macro.format_description.html /// [`format_description!`]: time::macros::format_description
/// [`time::format_description::parse`]: https://docs.rs/time/0.3/time/format_description/fn.parse.html /// [`time::format_description::parse`]: time::format_description::parse
/// [`time` book]: https://time-rs.github.io/book/api/format-description.html /// [`time` book]: https://time-rs.github.io/book/api/format-description.html
pub fn new(offset: time::UtcOffset, format: F) -> Self { pub fn new(offset: time::UtcOffset, format: F) -> Self {
Self { offset, format } Self { offset, format }

View File

@ -1,6 +1,6 @@
//! Abstractions for creating [`io::Write`] instances. //! Abstractions for creating [`io::Write`] instances.
//! //!
//! [`io::Write`]: https://doc.rust-lang.org/std/io/trait.Write.html //! [`io::Write`]: std::io::Write
use std::{ use std::{
fmt, fmt,
io::{self, Write}, io::{self, Write},
@ -96,8 +96,8 @@ use tracing_core::Metadata;
pub trait MakeWriter<'a> { pub trait MakeWriter<'a> {
/// The concrete [`io::Write`] implementation returned by [`make_writer`]. /// The concrete [`io::Write`] implementation returned by [`make_writer`].
/// ///
/// [`io::Write`]: https://doc.rust-lang.org/std/io/trait.Write.html /// [`io::Write`]: std::io::Write
/// [`make_writer`]: #tymethod.make_writer /// [`make_writer`]: MakeWriter::make_writer
type Writer: io::Write; type Writer: io::Write;
/// Returns an instance of [`Writer`]. /// Returns an instance of [`Writer`].
@ -109,7 +109,7 @@ pub trait MakeWriter<'a> {
/// creating a [`io::Write`] instance is expensive, be sure to cache it when implementing /// creating a [`io::Write`] instance is expensive, be sure to cache it when implementing
/// [`MakeWriter`] to improve performance. /// [`MakeWriter`] to improve performance.
/// ///
/// [`Writer`]: #associatedtype.Writer /// [`Writer`]: MakeWriter::Writer
/// [`fmt::Layer`]: crate::fmt::Layer /// [`fmt::Layer`]: crate::fmt::Layer
/// [`fmt::Subscriber`]: crate::fmt::Subscriber /// [`fmt::Subscriber`]: crate::fmt::Subscriber
/// [`io::Write`]: std::io::Write /// [`io::Write`]: std::io::Write
@ -505,9 +505,9 @@ pub trait MakeWriterExt<'a>: MakeWriter<'a> {
/// [`fmt::Layer`]: super::Layer /// [`fmt::Layer`]: super::Layer
/// [capturing]: https://doc.rust-lang.org/book/ch11-02-running-tests.html#showing-function-output /// [capturing]: https://doc.rust-lang.org/book/ch11-02-running-tests.html#showing-function-output
/// [nocapture]: https://doc.rust-lang.org/cargo/commands/cargo-test.html /// [nocapture]: https://doc.rust-lang.org/cargo/commands/cargo-test.html
/// [`io::stdout`]: https://doc.rust-lang.org/std/io/fn.stdout.html /// [`io::stdout`]: std::io::stdout
/// [`io::stderr`]: https://doc.rust-lang.org/std/io/fn.stderr.html /// [`io::stderr`]: std::io::stderr
/// [`print!`]: https://doc.rust-lang.org/std/macro.print.html /// [`print!`]: std::print!
#[derive(Default, Debug)] #[derive(Default, Debug)]
pub struct TestWriter { pub struct TestWriter {
_p: (), _p: (),
@ -646,10 +646,9 @@ pub struct Tee<A, B> {
/// requires the `Writer` type to implement [`io::Write`], it's necessary to add /// requires the `Writer` type to implement [`io::Write`], it's necessary to add
/// a newtype that forwards the trait implementation. /// a newtype that forwards the trait implementation.
/// ///
/// [`io::Write`]: https://doc.rust-lang.org/std/io/trait.Write.html /// [`io::Write`]: std::io::Write
/// [`MutexGuard`]: https://doc.rust-lang.org/std/sync/struct.MutexGuard.html /// [`MutexGuard`]: std::sync::MutexGuard
/// [`Mutex`]: https://doc.rust-lang.org/std/sync/struct.Mutex.html /// [`Mutex`]: std::sync::Mutex
/// [`MakeWriter`]: MakeWriter
#[derive(Debug)] #[derive(Debug)]
pub struct MutexGuardWriter<'a, W>(MutexGuard<'a, W>); pub struct MutexGuardWriter<'a, W>(MutexGuard<'a, W>);
@ -734,7 +733,6 @@ impl<'a> MakeWriter<'a> for TestWriter {
impl BoxMakeWriter { impl BoxMakeWriter {
/// Constructs a `BoxMakeWriter` wrapping a type implementing [`MakeWriter`]. /// Constructs a `BoxMakeWriter` wrapping a type implementing [`MakeWriter`].
/// ///
/// [`MakeWriter`]: MakeWriter
pub fn new<M>(make_writer: M) -> Self pub fn new<M>(make_writer: M) -> Self
where where
M: for<'a> MakeWriter<'a> + Send + Sync + 'static, M: for<'a> MakeWriter<'a> + Send + Sync + 'static,

View File

@ -26,7 +26,7 @@ use crate::{filter::FilterId, registry::Registry};
/// ``` /// ```
/// ///
/// [`Layer`]: super::Layer /// [`Layer`]: super::Layer
/// [`Subscriber`]: https://docs.rs/tracing-core/latest/tracing_core/trait.Subscriber.html /// [`Subscriber`]: tracing_core::Subscriber
/// [stored data]: crate::registry::SpanRef /// [stored data]: crate::registry::SpanRef
/// [`LookupSpan`]: crate::registry::LookupSpan /// [`LookupSpan`]: crate::registry::LookupSpan
#[derive(Debug)] #[derive(Debug)]
@ -99,9 +99,9 @@ where
/// check whether the event would be enabled. This allows `Layer`s to /// check whether the event would be enabled. This allows `Layer`s to
/// elide constructing the event if it would not be recorded. /// elide constructing the event if it would not be recorded.
/// ///
/// [register]: https://docs.rs/tracing-core/latest/tracing_core/subscriber/trait.Subscriber.html#method.register_callsite /// [register]: tracing_core::subscriber::Subscriber::register_callsite()
/// [`enabled`]: https://docs.rs/tracing-core/latest/tracing_core/subscriber/trait.Subscriber.html#method.enabled /// [`enabled`]: tracing_core::subscriber::Subscriber::enabled()
/// [`Context::enabled`]: #method.enabled /// [`Context::enabled`]: Context::enabled()
#[inline] #[inline]
pub fn event(&self, event: &Event<'_>) { pub fn event(&self, event: &Event<'_>) {
if let Some(subscriber) = self.subscriber { if let Some(subscriber) = self.subscriber {

View File

@ -18,7 +18,7 @@ use core::{any::TypeId, cmp, fmt, marker::PhantomData};
/// [`Layer`]s. /// [`Layer`]s.
/// ///
/// [`Layer`]: crate::Layer /// [`Layer`]: crate::Layer
/// [`Subscriber`]: https://docs.rs/tracing-core/latest/tracing_core/trait.Subscriber.html /// [`Subscriber`]: tracing_core::Subscriber
#[derive(Clone)] #[derive(Clone)]
pub struct Layered<L, I, S = I> { pub struct Layered<L, I, S = I> {
/// The layer. /// The layer.

View File

@ -629,15 +629,15 @@
//! # Ok(()) } //! # Ok(()) }
//! ``` //! ```
//! //!
//! [`Subscriber`]: https://docs.rs/tracing-core/latest/tracing_core/subscriber/trait.Subscriber.html //! [`Subscriber`]: tracing_core::subscriber::Subscriber
//! [span IDs]: https://docs.rs/tracing-core/latest/tracing_core/span/struct.Id.html //! [span IDs]: tracing_core::span::Id
//! [the current span]: Context::current_span //! [the current span]: Context::current_span
//! [`register_callsite`]: Layer::register_callsite //! [`register_callsite`]: Layer::register_callsite
//! [`enabled`]: Layer::enabled //! [`enabled`]: Layer::enabled
//! [`on_enter`]: Layer::on_enter //! [`on_enter`]: Layer::on_enter
//! [`Layer::register_callsite`]: Layer::register_callsite //! [`Layer::register_callsite`]: Layer::register_callsite
//! [`Layer::enabled`]: Layer::enabled //! [`Layer::enabled`]: Layer::enabled
//! [`Interest::never()`]: https://docs.rs/tracing-core/latest/tracing_core/subscriber/struct.Interest.html#method.never //! [`Interest::never()`]: tracing_core::subscriber::Interest::never()
//! [`Filtered`]: crate::filter::Filtered //! [`Filtered`]: crate::filter::Filtered
//! [`filter`]: crate::filter //! [`filter`]: crate::filter
//! [`Targets`]: crate::filter::Targets //! [`Targets`]: crate::filter::Targets
@ -749,15 +749,15 @@ where
/// globally enable or disable those callsites, it should always return /// globally enable or disable those callsites, it should always return
/// [`Interest::always()`]. /// [`Interest::always()`].
/// ///
/// [`Interest`]: https://docs.rs/tracing-core/latest/tracing_core/struct.Interest.html /// [`Interest`]: tracing_core::Interest
/// [`Subscriber::register_callsite`]: https://docs.rs/tracing-core/latest/tracing_core/trait.Subscriber.html#method.register_callsite /// [`Subscriber::register_callsite`]: tracing_core::Subscriber::register_callsite()
/// [`Interest::never()`]: https://docs.rs/tracing-core/latest/tracing_core/subscriber/struct.Interest.html#method.never /// [`Interest::never()`]: tracing_core::subscriber::Interest::never()
/// [`Interest::always()`]: https://docs.rs/tracing-core/latest/tracing_core/subscriber/struct.Interest.html#method.always /// [`Interest::always()`]: tracing_core::subscriber::Interest::always()
/// [`self.enabled`]: #method.enabled /// [`self.enabled`]: Layer::enabled()
/// [`Layer::enabled`]: #method.enabled /// [`Layer::enabled`]: Layer::enabled()
/// [`on_event`]: #method.on_event /// [`on_event`]: Layer::on_event()
/// [`on_enter`]: #method.on_enter /// [`on_enter`]: Layer::on_enter()
/// [`on_exit`]: #method.on_exit /// [`on_exit`]: Layer::on_exit()
/// [the trait-level documentation]: #filtering-with-layers /// [the trait-level documentation]: #filtering-with-layers
fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest { fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest {
if self.enabled(metadata, Context::none()) { if self.enabled(metadata, Context::none()) {
@ -792,13 +792,12 @@ where
/// See [the trait-level documentation] for more information on filtering /// See [the trait-level documentation] for more information on filtering
/// with `Layer`s. /// with `Layer`s.
/// ///
/// [`Interest`]: https://docs.rs/tracing-core/latest/tracing_core/struct.Interest.html /// [`Interest`]: tracing_core::Interest
/// [`Context`]: Context /// [`Subscriber::enabled`]: tracing_core::Subscriber::enabled()
/// [`Subscriber::enabled`]: https://docs.rs/tracing-core/latest/tracing_core/trait.Subscriber.html#method.enabled /// [`Layer::register_callsite`]: Layer::register_callsite()
/// [`Layer::register_callsite`]: #method.register_callsite /// [`on_event`]: Layer::on_event()
/// [`on_event`]: #method.on_event /// [`on_enter`]: Layer::on_enter()
/// [`on_enter`]: #method.on_enter /// [`on_exit`]: Layer::on_exit()
/// [`on_exit`]: #method.on_exit
/// [the trait-level documentation]: #filtering-with-layers /// [the trait-level documentation]: #filtering-with-layers
fn enabled(&self, metadata: &Metadata<'_>, ctx: Context<'_, S>) -> bool { fn enabled(&self, metadata: &Metadata<'_>, ctx: Context<'_, S>) -> bool {
let _ = (metadata, ctx); let _ = (metadata, ctx);
@ -997,7 +996,7 @@ where
/// .with_subscriber(MySubscriber::new()); /// .with_subscriber(MySubscriber::new());
///``` ///```
/// ///
/// [`Subscriber`]: https://docs.rs/tracing-core/latest/tracing_core/trait.Subscriber.html /// [`Subscriber`]: tracing_core::Subscriber
fn with_subscriber(mut self, mut inner: S) -> Layered<Self, S> fn with_subscriber(mut self, mut inner: S) -> Layered<Self, S>
where where
Self: Sized, Self: Sized,

View File

@ -149,8 +149,8 @@
//! supported compiler version is not considered a semver breaking change as //! supported compiler version is not considered a semver breaking change as
//! long as doing so complies with this policy. //! long as doing so complies with this policy.
//! //!
//! [`tracing`]: https://docs.rs/tracing/latest/tracing/ //! [`Subscriber`]: tracing_core::subscriber::Subscriber
//! [`Subscriber`]: https://docs.rs/tracing-core/latest/tracing_core/subscriber/trait.Subscriber.html //! [`tracing`]: https://docs.rs/tracing/latest/tracing
//! [`EnvFilter`]: filter::EnvFilter //! [`EnvFilter`]: filter::EnvFilter
//! [`fmt`]: mod@fmt //! [`fmt`]: mod@fmt
//! [`tracing-log`]: https://crates.io/crates/tracing-log //! [`tracing-log`]: https://crates.io/crates/tracing-log
@ -158,8 +158,8 @@
//! [`env_logger` crate]: https://crates.io/crates/env_logger //! [`env_logger` crate]: https://crates.io/crates/env_logger
//! [`parking_lot`]: https://crates.io/crates/parking_lot //! [`parking_lot`]: https://crates.io/crates/parking_lot
//! [`time` crate]: https://crates.io/crates/time //! [`time` crate]: https://crates.io/crates/time
//! [`libstd`]: https://doc.rust-lang.org/std/index.html //! [`libstd`]: std
//! [`liballoc`]: https://doc.rust-lang.org/alloc/index.html //! [`liballoc`]: alloc
#![doc(html_root_url = "https://docs.rs/tracing-subscriber/0.3.11")] #![doc(html_root_url = "https://docs.rs/tracing-subscriber/0.3.11")]
#![doc( #![doc(
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png", html_logo_url = "https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png",

View File

@ -78,7 +78,7 @@ impl<'a> ExtensionsMut<'a> {
/// should be able to reuse timestamp _x_. /// should be able to reuse timestamp _x_.
/// ///
/// Therefore, extensions should generally be newtypes, rather than common /// Therefore, extensions should generally be newtypes, rather than common
/// types like [`String`](https://doc.rust-lang.org/std/string/struct.String.html), to avoid accidental /// types like [`String`](std::string::String), to avoid accidental
/// cross-`Layer` clobbering. /// cross-`Layer` clobbering.
/// ///
/// ## Panics /// ## Panics

View File

@ -55,8 +55,7 @@
//! require the root subscriber to be a registry. //! require the root subscriber to be a registry.
//! //!
//! [`Layer`]: crate::layer::Layer //! [`Layer`]: crate::layer::Layer
//! [`Subscriber`]: //! [`Subscriber`]: tracing_core::Subscriber
//! https://docs.rs/tracing-core/latest/tracing_core/subscriber/trait.Subscriber.html
//! [ctx]: crate::layer::Context //! [ctx]: crate::layer::Context
//! [lookup]: crate::layer::Context::span() //! [lookup]: crate::layer::Context::span()
use tracing_core::{field::FieldSet, span::Id, Metadata}; use tracing_core::{field::FieldSet, span::Id, Metadata};
@ -104,7 +103,6 @@ pub trait LookupSpan<'a> {
/// capable of performing more sophisiticated queries. /// capable of performing more sophisiticated queries.
/// </pre> /// </pre>
/// ///
/// [`SpanData`]: SpanData
fn span_data(&'a self, id: &Id) -> Option<Self::Data>; fn span_data(&'a self, id: &Id) -> Option<Self::Data>;
/// Returns a [`SpanRef`] for the span with the given `Id`, if it exists. /// Returns a [`SpanRef`] for the span with the given `Id`, if it exists.
@ -116,9 +114,7 @@ pub trait LookupSpan<'a> {
/// rather than the [`span_data`] method; while _implementors_ of this trait /// rather than the [`span_data`] method; while _implementors_ of this trait
/// should only implement `span_data`. /// should only implement `span_data`.
/// ///
/// [`SpanRef`]: SpanRef /// [`span_data`]: LookupSpan::span_data()
/// [`SpanData`]: SpanData
/// [`span_data`]: #method.span_data
fn span(&'a self, id: &Id) -> Option<SpanRef<'_, Self>> fn span(&'a self, id: &Id) -> Option<SpanRef<'_, Self>>
where where
Self: Sized, Self: Sized,
@ -360,7 +356,7 @@ where
/// Returns a list of [fields] defined by the span. /// Returns a list of [fields] defined by the span.
/// ///
/// [fields]: https://docs.rs/tracing-core/latest/tracing_core/field/index.html /// [fields]: tracing_core::field
pub fn fields(&self) -> &FieldSet { pub fn fields(&self) -> &FieldSet {
self.data.metadata().fields() self.data.metadata().fields()
} }

View File

@ -75,16 +75,16 @@ use tracing_core::{
/// the distributed tracing system. These IDs can be associated with /// the distributed tracing system. These IDs can be associated with
/// `tracing` spans using [fields] and/or [stored span data]. /// `tracing` spans using [fields] and/or [stored span data].
/// ///
/// [span IDs]: https://docs.rs/tracing-core/latest/tracing_core/span/struct.Id.html /// [span IDs]: tracing_core::span::Id
/// [slab]: https://docs.rs/crate/sharded-slab/ /// [slab]: sharded_slab
/// [`Layer`]: crate::Layer /// [`Layer`]: crate::Layer
/// [added]: crate::layer::Layer#composing-layers /// [added]: crate::layer::Layer#composing-layers
/// [extensions]: super::Extensions /// [extensions]: super::Extensions
/// [closed]: https://docs.rs/tracing/latest/tracing/span/index.html#closing-spans /// [closed]: https://docs.rs/tracing/latest/tracing/span/index.html#closing-spans
/// [considered closed]: https://docs.rs/tracing-core/latest/tracing_core/subscriber/trait.Subscriber.html#method.try_close /// [considered closed]: tracing_core::subscriber::Subscriber::try_close()
/// [`Span`]: https://docs.rs/tracing/latest/tracing/span/struct.Span.html /// [`Span`]: https://docs.rs/tracing/latest/tracing/span/struct.Span.html
/// [ot]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#spancontext /// [ot]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#spancontext
/// [fields]: https://docs.rs/tracing-core/latest/tracing-core/field/index.html /// [fields]: tracing_core::field
/// [stored span data]: crate::registry::SpanData::extensions_mut /// [stored span data]: crate::registry::SpanData::extensions_mut
#[cfg(feature = "registry")] #[cfg(feature = "registry")]
#[cfg_attr(docsrs, doc(cfg(all(feature = "registry", feature = "std"))))] #[cfg_attr(docsrs, doc(cfg(all(feature = "registry", feature = "std"))))]
@ -102,7 +102,6 @@ pub struct Registry {
/// [`Layer`s], such as formatted fields, metrics, or distributed traces should /// [`Layer`s], such as formatted fields, metrics, or distributed traces should
/// be stored in the [extensions] typemap. /// be stored in the [extensions] typemap.
/// ///
/// [`Registry`]: Registry
/// [`Layer`s]: crate::layer::Layer /// [`Layer`s]: crate::layer::Layer
/// [extensions]: Extensions /// [extensions]: Extensions
#[cfg(feature = "registry")] #[cfg(feature = "registry")]
@ -115,10 +114,11 @@ pub struct Data<'a> {
/// Stored data associated with a span. /// Stored data associated with a span.
/// ///
/// This type is pooled using `sharded_slab::Pool`; when a span is dropped, the /// This type is pooled using [`sharded_slab::Pool`]; when a span is
/// `DataInner` entry at that span's slab index is cleared in place and reused /// dropped, the `DataInner` entry at that span's slab index is cleared
/// by a future span. Thus, the `Default` and `sharded_slab::Clear` /// in place and reused by a future span. Thus, the `Default` and
/// implementations for this type are load-bearing. /// [`sharded_slab::Clear`] implementations for this type are
/// load-bearing.
#[derive(Debug)] #[derive(Debug)]
struct DataInner { struct DataInner {
filter_map: FilterMap, filter_map: FilterMap,
@ -173,7 +173,6 @@ fn id_to_idx(id: &Id) -> usize {
/// greater than 0, `CloseGuard` decrements the counter by one and /// greater than 0, `CloseGuard` decrements the counter by one and
/// _does not_ remove the span from the [`Registry`]. /// _does not_ remove the span from the [`Registry`].
/// ///
/// [`Registry`]: Registry
pub(crate) struct CloseGuard<'a> { pub(crate) struct CloseGuard<'a> {
id: Id, id: Id,
registry: &'a Registry, registry: &'a Registry,
@ -189,7 +188,6 @@ impl Registry {
/// processed an `on_close` notification via the `CLOSE_COUNT` thread-local. /// processed an `on_close` notification via the `CLOSE_COUNT` thread-local.
/// For additional details, see [`CloseGuard`]. /// For additional details, see [`CloseGuard`].
/// ///
/// [`CloseGuard`]: CloseGuard
pub(crate) fn start_close(&self, id: Id) -> CloseGuard<'_> { pub(crate) fn start_close(&self, id: Id) -> CloseGuard<'_> {
CLOSE_COUNT.with(|count| { CLOSE_COUNT.with(|count| {
let c = count.get(); let c = count.get();
@ -216,7 +214,6 @@ thread_local! {
/// track how many layers have processed the close. /// track how many layers have processed the close.
/// For additional details, see [`CloseGuard`]. /// For additional details, see [`CloseGuard`].
/// ///
/// [`CloseGuard`]: CloseGuard
static CLOSE_COUNT: Cell<usize> = Cell::new(0); static CLOSE_COUNT: Cell<usize> = Cell::new(0);
} }

View File

@ -123,10 +123,6 @@
//! instrumentation. //! instrumentation.
//! //!
//! [`Subscriber`]: crate::Subscriber //! [`Subscriber`]: crate::Subscriber
//! [`with_default`]: with_default
//! [`set_global_default`]: set_global_default
//! [`get_default`]: get_default
//! [`Dispatch`]: Dispatch
#[cfg(feature = "std")] #[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))] #[cfg_attr(docsrs, doc(cfg(feature = "std")))]
pub use tracing_core::dispatcher::set_default; pub use tracing_core::dispatcher::set_default;

View File

@ -437,9 +437,9 @@
//! [target]: Metadata::target //! [target]: Metadata::target
//! [parent span]: span::Attributes::parent //! [parent span]: span::Attributes::parent
//! [determined contextually]: span::Attributes::is_contextual //! [determined contextually]: span::Attributes::is_contextual
//! [`fmt::Debug`]: https://doc.rust-lang.org/std/fmt/trait.Debug.html //! [`fmt::Debug`]: std::fmt::Debug
//! [`fmt::Display`]: https://doc.rust-lang.org/std/fmt/trait.Display.html //! [`fmt::Display`]: std::fmt::Display
//! [fmt]: https://doc.rust-lang.org/std/fmt/#usage //! [fmt]: std::fmt#usage
//! [`Empty`]: field::Empty //! [`Empty`]: field::Empty
//! //!
//! ### Shorthand Macros //! ### Shorthand Macros
@ -466,7 +466,6 @@
//! [`info_span!`]: info_span! //! [`info_span!`]: info_span!
//! [`warn_span!`]: warn_span! //! [`warn_span!`]: warn_span!
//! [`error_span!`]: error_span! //! [`error_span!`]: error_span!
//! [`Level`]: Level
//! //!
//! ### For `log` Users //! ### For `log` Users
//! //!

View File

@ -718,8 +718,8 @@ impl Span {
/// ``` /// ```
/// ///
/// [syntax]: https://rust-lang.github.io/async-book/01_getting_started/04_async_await_primer.html /// [syntax]: https://rust-lang.github.io/async-book/01_getting_started/04_async_await_primer.html
/// [`Span::in_scope`]: #method.in_scope /// [`Span::in_scope`]: Span::in_scope()
/// [instrument]: https://docs.rs/tracing/latest/tracing/trait.Instrument.html /// [instrument]: crate::Instrument
/// [attr]: macro@crate::instrument /// [attr]: macro@crate::instrument
/// ///
/// # Examples /// # Examples
@ -1239,7 +1239,7 @@ impl Span {
/// ///
/// See also [`is_none`]. /// See also [`is_none`].
/// ///
/// [`is_none`]: #method.is_none /// [`is_none`]: Span::is_none()
#[inline] #[inline]
pub fn is_disabled(&self) -> bool { pub fn is_disabled(&self) -> bool {
self.inner.is_none() self.inner.is_none()
@ -1253,8 +1253,8 @@ impl Span {
/// rather than constructed by `Span::none`, this method will return /// rather than constructed by `Span::none`, this method will return
/// `false`, while `is_disabled` will return `true`. /// `false`, while `is_disabled` will return `true`.
/// ///
/// [`Span::none`]: #method.none /// [`Span::none`]: Span::none()
/// [`is_disabled`]: #method.is_disabled /// [`is_disabled`]: Span::is_disabled()
#[inline] #[inline]
pub fn is_none(&self) -> bool { pub fn is_none(&self) -> bool {
self.is_disabled() && self.meta.is_none() self.is_disabled() && self.meta.is_none()