mirror of
https://github.com/tokio-rs/tracing.git
synced 2025-09-30 06:20:38 +00:00
chore: fix spaces (#715)
## Motivation There are unnecessary spaces. Also, there is a point that requires space. * chore: Remove duplicated spaces * chore: Add space to make code consistent
This commit is contained in:
parent
369b0c5e1d
commit
f8a9769622
@ -247,7 +247,7 @@ attachment that `Future::instrument` does.
|
||||
First, see if the answer to your question can be found in the API documentation.
|
||||
If the answer is not there, there is an active community in
|
||||
the [Tracing Discord channel][chat]. We would be happy to try to answer your
|
||||
question. Last, if that doesn't work, try opening an [issue] with the question.
|
||||
question. Last, if that doesn't work, try opening an [issue] with the question.
|
||||
|
||||
[chat]: https://discord.gg/EeF3cQw
|
||||
[issue]: https://github.com/tokio-rs/tracing/issues/new
|
||||
|
@ -225,7 +225,7 @@ pub fn with_default<T>(dispatcher: &Dispatch, f: impl FnOnce() -> T) -> T {
|
||||
/// Sets the dispatch as the default dispatch for the duration of the lifetime
|
||||
/// of the returned DefaultGuard
|
||||
///
|
||||
/// **Note**: This function required the Rust standard library. `no_std` users
|
||||
/// **Note**: This function required the Rust standard library. `no_std` users
|
||||
/// should use [`set_global_default`] instead.
|
||||
///
|
||||
/// [`set_global_default`]: ../fn.set_global_default.html
|
||||
@ -522,7 +522,7 @@ impl Dispatch {
|
||||
/// this guarantee and any other libraries implementing instrumentation APIs
|
||||
/// must as well.
|
||||
///
|
||||
/// This calls the [`drop_span`] function on the [`Subscriber`] that this
|
||||
/// This calls the [`drop_span`] function on the [`Subscriber`] that this
|
||||
/// `Dispatch` forwards to.
|
||||
///
|
||||
/// **Note:** the [`try_close`] function is functionally identical, but
|
||||
@ -548,7 +548,7 @@ impl Dispatch {
|
||||
/// this guarantee and any other libraries implementing instrumentation APIs
|
||||
/// must as well.
|
||||
///
|
||||
/// This calls the [`try_close`] function on the [`Subscriber`] that this
|
||||
/// This calls the [`try_close`] function on the [`Subscriber`] that this
|
||||
/// `Dispatch` forwards to.
|
||||
///
|
||||
/// [span ID]: ../span/struct.Id.html
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Span and `Event` key-value data.
|
||||
//!
|
||||
//! Spans and events may be annotated with key-value data, referred to as known
|
||||
//! Spans and events may be annotated with key-value data, referred to as known
|
||||
//! as _fields_. These fields consist of a mapping from a key (corresponding to
|
||||
//! a `&str` but represented internally as an array index) to a [`Value`].
|
||||
//!
|
||||
|
@ -27,7 +27,7 @@ use crate::stdlib::{fmt, str::FromStr};
|
||||
/// particular event or span is constructed statically and exists as a single
|
||||
/// static instance. Thus, the overhead of creating the metadata is
|
||||
/// _significantly_ lower than that of creating the actual span. Therefore,
|
||||
/// filtering is based on metadata, rather than on the constructed span.
|
||||
/// filtering is based on metadata, rather than on the constructed span.
|
||||
///
|
||||
/// **Note**: Although instances of `Metadata` cannot be compared directly, they
|
||||
/// provide a method [`id`] which returns an opaque [callsite identifier]
|
||||
|
@ -70,7 +70,7 @@ impl Id {
|
||||
|
||||
// Allow `into` by-ref since we don't want to impl Copy for Id
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
/// Returns the span's ID as a `u64`.
|
||||
/// Returns the span's ID as a `u64`.
|
||||
pub fn into_u64(&self) -> u64 {
|
||||
self.0.get()
|
||||
}
|
||||
|
@ -352,12 +352,12 @@ pub trait Subscriber: 'static {
|
||||
/// It's guaranteed that if this function has been called once more than the
|
||||
/// number of times `clone_span` was called with the same `id`, then no more
|
||||
/// handles that can enter the span with that `id` exist. This means that it
|
||||
/// can be used in conjunction with [`clone_span`] to track the number of
|
||||
/// can be used in conjunction with [`clone_span`] to track the number of
|
||||
/// handles capable of `enter`ing a span. When all the handles have been
|
||||
/// dropped (i.e., `try_close` has been called one more time than
|
||||
/// `clone_span` for a given ID), the subscriber may assume that the span
|
||||
/// will not be entered again, and should return `true`. It is then free to
|
||||
/// deallocate storage for data associated with that span, write data from
|
||||
/// deallocate storage for data associated with that span, write data from
|
||||
/// that span to IO, and so on.
|
||||
///
|
||||
/// **Note**: since this function is called when spans are dropped,
|
||||
@ -475,7 +475,7 @@ impl Interest {
|
||||
Interest(InterestKind::Never)
|
||||
}
|
||||
|
||||
/// Returns an `Interest` indicating the subscriber is sometimes interested
|
||||
/// Returns an `Interest` indicating the subscriber is sometimes interested
|
||||
/// in being notified about a callsite.
|
||||
///
|
||||
/// If all active subscribers are `sometimes` or `never` interested in a
|
||||
@ -487,7 +487,7 @@ impl Interest {
|
||||
Interest(InterestKind::Sometimes)
|
||||
}
|
||||
|
||||
/// Returns an `Interest` indicating the subscriber is always interested in
|
||||
/// Returns an `Interest` indicating the subscriber is always interested in
|
||||
/// being notified about a callsite.
|
||||
///
|
||||
/// If any subscriber expresses that it is `always()` interested in a given
|
||||
|
@ -25,7 +25,7 @@
|
||||
//! `tokio::executor::Executor`, `tokio::runtime::Runtime`, and
|
||||
//! `tokio::runtime::current_thread`. Enabled by default.
|
||||
//! - `tokio-executor`: Enables compatibility with the `tokio-executor`
|
||||
//! crate, including [`Instrument`] and [`WithSubscriber`]
|
||||
//! crate, including [`Instrument`] and [`WithSubscriber`]
|
||||
//! implementations for types implementing `tokio_executor::Executor`.
|
||||
//! This is intended primarily for use in crates which depend on
|
||||
//! `tokio-executor` rather than `tokio`; in general the `tokio` feature
|
||||
|
@ -69,7 +69,7 @@ using method-chaining style. Additionally, several bugs in less commonly used
|
||||
|
||||
- **filter**: Fixed `EnvFilter` incorrectly allowing less-specific filter
|
||||
directives to enable events that are disabled by more-specific filters (#583)
|
||||
- **filter**: Multiple significant `EnvFilter` performance improvements,
|
||||
- **filter**: Multiple significant `EnvFilter` performance improvements,
|
||||
especially when filtering events generated by `log` records (#578, #583)
|
||||
- **filter**: Replaced `BTreeMap` with `Vec` in `DirectiveSet`, improving
|
||||
iteration performance significantly with typical numbers of filter directives
|
||||
|
@ -40,7 +40,7 @@ use tracing_core::{
|
||||
/// # tracing::subscriber::set_global_default(subscriber).unwrap();
|
||||
/// ```
|
||||
///
|
||||
/// Setting a custom event formatter:
|
||||
/// Setting a custom event formatter:
|
||||
///
|
||||
/// ```rust
|
||||
/// use tracing_subscriber::fmt::{self, format, time};
|
||||
|
@ -529,7 +529,7 @@ pub struct Identity {
|
||||
}
|
||||
|
||||
/// An iterator over the [stored data] for all the spans in the
|
||||
/// current context, starting the root of the trace tree and ending with
|
||||
/// current context, starting the root of the trace tree and ending with
|
||||
/// the current span.
|
||||
///
|
||||
/// This is returned by [`Context::scope`].
|
||||
@ -672,7 +672,7 @@ where
|
||||
let outer = self.layer.register_callsite(metadata);
|
||||
if outer.is_never() {
|
||||
// if the outer layer has disabled the callsite, return now so that
|
||||
// inner layers don't get their hopes up.
|
||||
// inner layers don't get their hopes up.
|
||||
return outer;
|
||||
}
|
||||
|
||||
@ -949,7 +949,7 @@ impl<'a, S: Subscriber> Context<'a, S> {
|
||||
}
|
||||
|
||||
/// Returns an iterator over the [stored data] for all the spans in the
|
||||
/// current context, starting the root of the trace tree and ending with
|
||||
/// current context, starting the root of the trace tree and ending with
|
||||
/// the current span.
|
||||
///
|
||||
/// If this iterator is empty, then there are no spans in the current context
|
||||
|
@ -5,7 +5,7 @@
|
||||
//! This module provides the [`Registry`] type, a [`Subscriber`] implementation
|
||||
//! which tracks per-span data and exposes it to [`Layer`]s. When a `Registry`
|
||||
//! is used as the base `Subscriber` of a `Layer` stack, the
|
||||
//! [`layer::Context`][ctx] type will provide methods allowing `Layer`s to
|
||||
//! [`layer::Context`][ctx] type will provide methods allowing `Layer`s to
|
||||
//! [look up span data][lookup] stored in the registry. While [`Registry`] is a
|
||||
//! reasonable default for storing spans and events, other stores that implement
|
||||
//! [`LookupSpan`] and [`Subscriber`] themselves (with [`SpanData`] implemented
|
||||
|
@ -26,7 +26,7 @@ use tracing_core::{
|
||||
/// instead, it collects and stores span data that is exposed to any `Layer`s
|
||||
/// wrapping it through implementations of the [`LookupSpan`] trait.
|
||||
/// The `Registry` is responsible for storing span metadata, recording
|
||||
/// relationships between spans, and tracking which spans are active and whicb
|
||||
/// relationships between spans, and tracking which spans are active and whicb
|
||||
/// are closed. In addition, it provides a mechanism for `Layer`s to store
|
||||
/// user-defined per-span data, called [extensions], in the registry. This
|
||||
/// allows `Layer`-specific data to benefit from the `Registry`'s
|
||||
@ -216,7 +216,7 @@ impl Subscriber for Registry {
|
||||
// Like `std::sync::Arc`, adds to the ref count (on clone) don't require
|
||||
// a strong ordering; if we call` clone_span`, the reference count must
|
||||
// always at least 1. The only synchronization necessary is between
|
||||
// calls to `try_close`: we have to ensure that all threads have
|
||||
// calls to `try_close`: we have to ensure that all threads have
|
||||
// dropped their refs to the span before the span is closed.
|
||||
let refs = span.ref_count.fetch_add(1, Ordering::Relaxed);
|
||||
assert!(refs != 0, "tried to clone a span that already closed");
|
||||
|
@ -15,7 +15,7 @@ use tracing_core::dispatcher::{self, Dispatch};
|
||||
/// implementation of this trait.
|
||||
///
|
||||
/// [default subscriber]: https://docs.rs/tracing/0.1.13/tracing/dispatcher/index.html#setting-the-default-subscriber
|
||||
/// [trace dispatcher]: https://docs.rs/tracing/0.1.13/tracing/dispatcher/index.html
|
||||
/// [trace dispatcher]: https://docs.rs/tracing/0.1.13/tracing/dispatcher/index.html
|
||||
pub trait SubscriberInitExt
|
||||
where
|
||||
Self: Into<Dispatch>,
|
||||
|
@ -95,7 +95,7 @@
|
||||
//! or `Event`. If a call to `Subscriber::enabled` returns `false` for a given
|
||||
//! set of metadata, that `Subscriber` will *not* be notified about the
|
||||
//! corresponding `Span` or `Event`. For performance reasons, if no currently
|
||||
//! active subscribers express interest in a given set of metadata by returning
|
||||
//! active subscribers express interest in a given set of metadata by returning
|
||||
//! `true`, then the corresponding `Span` or `Event` will never be constructed.
|
||||
//!
|
||||
//! # Usage
|
||||
@ -325,7 +325,7 @@
|
||||
//! # field: "Hello world!"
|
||||
//! # };
|
||||
//! // `my_struct.field` will be recorded using its `fmt::Display` implementation.
|
||||
//! event!(Level::TRACE, %my_struct.field);
|
||||
//! event!(Level::TRACE, %my_struct.field);
|
||||
//! # }
|
||||
//! ```
|
||||
//!
|
||||
|
@ -30,7 +30,7 @@ macro_rules! span {
|
||||
(target: $target:expr, parent: $parent:expr, $lvl:expr, $name:expr) => {
|
||||
$crate::span!(target: $target, parent: $parent, $lvl, $name,)
|
||||
};
|
||||
(parent: $parent:expr, $lvl:expr, $name:expr, $($fields:tt)*) => {
|
||||
(parent: $parent:expr, $lvl:expr, $name:expr, $($fields:tt)*) => {
|
||||
$crate::span!(
|
||||
target: module_path!(),
|
||||
parent: $parent,
|
||||
@ -782,7 +782,7 @@ macro_rules! trace {
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::TRACE, { $($field)* }, $($arg)*)
|
||||
);
|
||||
(target: $target:expr, parent: $parent:expr, $($k:ident).+ $($field:tt)+ ) => (
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::TRACE, { $($k).+ $($field)+ })
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::TRACE, { $($k).+ $($field)+ })
|
||||
);
|
||||
(target: $target:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => (
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::TRACE, { $($k).+ $($field)+ })
|
||||
@ -969,10 +969,10 @@ macro_rules! debug {
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::DEBUG, { $($field)* }, $($arg)*)
|
||||
);
|
||||
(target: $target:expr, parent: $parent:expr, $($k:ident).+ $($field:tt)+ ) => (
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::DEBUG, { $($k).+ $($field)+ })
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::DEBUG, { $($k).+ $($field)+ })
|
||||
);
|
||||
(target: $target:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => (
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::DEBUG, { $($k).+ $($field)+ })
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::DEBUG, { $($k).+ $($field)+ })
|
||||
);
|
||||
(target: $target:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => (
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::DEBUG, { $($k).+ $($field)+ })
|
||||
@ -1160,7 +1160,7 @@ macro_rules! debug {
|
||||
/// # pub struct Ipv4Addr;
|
||||
/// # impl Ipv4Addr { fn new(o1: u8, o2: u8, o3: u8, o4: u8) -> Self { Self } }
|
||||
/// # fn main() {
|
||||
/// # struct Connection { port: u32, speed: f32 }
|
||||
/// # struct Connection { port: u32, speed: f32 }
|
||||
/// use tracing::field;
|
||||
///
|
||||
/// let addr = Ipv4Addr::new(127, 0, 0, 1);
|
||||
@ -1184,7 +1184,7 @@ macro_rules! info {
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::INFO, { $($k).+ $($field)+ })
|
||||
);
|
||||
(target: $target:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => (
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::INFO, { $($k).+ $($field)+ })
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::INFO, { $($k).+ $($field)+ })
|
||||
);
|
||||
(target: $target:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => (
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::INFO, { $($k).+ $($field)+ })
|
||||
@ -1389,7 +1389,7 @@ macro_rules! warn {
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::WARN, { $($k).+ $($field)+ })
|
||||
);
|
||||
(target: $target:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => (
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::WARN, { $($k).+ $($field)+ })
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::WARN, { $($k).+ $($field)+ })
|
||||
);
|
||||
(target: $target:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => (
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::WARN, { $($k).+ $($field)+ })
|
||||
@ -1590,7 +1590,7 @@ macro_rules! error {
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::ERROR, { $($k).+ $($field)+ })
|
||||
);
|
||||
(target: $target:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => (
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::ERROR, { $($k).+ $($field)+ })
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::ERROR, { $($k).+ $($field)+ })
|
||||
);
|
||||
(target: $target:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => (
|
||||
$crate::event!(target: $target, parent: $parent, $crate::Level::ERROR, { $($k).+ $($field)+ })
|
||||
|
@ -161,7 +161,7 @@
|
||||
//! might want to have a span representing the listener, and instrument each
|
||||
//! spawned handler task with its own span. We would want our instrumentation to
|
||||
//! record that the handler tasks were spawned as a result of the listener task.
|
||||
//! However, we might not consider the handler tasks to be _part_ of the time
|
||||
//! However, we might not consider the handler tasks to be _part_ of the time
|
||||
//! spent in the listener task, so we would not consider those spans children of
|
||||
//! the listener span. Instead, we would record that the handler tasks follow
|
||||
//! from the listener, recording the causal relationship but treating the spans
|
||||
@ -229,7 +229,7 @@
|
||||
//!
|
||||
//! However, if multiple handles exist, the span can still be re-entered even if
|
||||
//! one or more is dropped. For determining when _all_ handles to a span have
|
||||
//! been dropped, `Subscriber`s have a [`clone_span`] method, which is called
|
||||
//! been dropped, `Subscriber`s have a [`clone_span`] method, which is called
|
||||
//! every time a span handle is cloned. Combined with `drop_span`, this may be
|
||||
//! used to track the number of handles to a given span — if `drop_span` has
|
||||
//! been called one more time than the number of calls to `clone_span` for a
|
||||
@ -734,7 +734,7 @@ impl Span {
|
||||
/// empty.
|
||||
///
|
||||
/// If `is_none` returns `true` for a given span, then [`is_disabled`] will
|
||||
/// also return `true`. However, when a span is disabled by the subscriber
|
||||
/// also return `true`. However, when a span is disabled by the subscriber
|
||||
/// rather than constructed by `Span::none`, this method will return
|
||||
/// `false`, while `is_disabled` will return `true`.
|
||||
///
|
||||
|
@ -524,15 +524,15 @@ fn trace_root() {
|
||||
trace!(parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
|
||||
trace!(parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
|
||||
trace!(parent: None, { foo = 2, bar.baz = 78 }, "quux");
|
||||
trace!(parent:None, { foo = ?2, bar.baz = %78 }, "quux");
|
||||
trace!(parent: None, { foo = ?2, bar.baz = %78 }, "quux");
|
||||
trace!(target: "foo_events", parent: None, foo = 3, bar.baz = 2, quux = false);
|
||||
trace!(target: "foo_events", parent: None, foo = 3, bar.baz = 3,);
|
||||
trace!(target: "foo_events", parent: None, "foo");
|
||||
trace!(target: "foo_events", parent: None, "foo: {}", 3);
|
||||
trace!(target: "foo_events", parent: None, { foo = 3, bar.baz = 80 }, "quux");
|
||||
trace!(target: "foo_events", parent: None, { foo = 3, bar.baz = 80 }, "quux");
|
||||
trace!(target: "foo_events", parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
|
||||
trace!(target: "foo_events", parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
|
||||
trace!(target: "foo_events", parent: None, { foo = 2, bar.baz = 78, }, "quux");
|
||||
trace!(target: "foo_events", parent: None, { foo = 2, bar.baz = 78, }, "quux");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -662,10 +662,10 @@ fn trace_with_parent() {
|
||||
trace!(target: "foo_events", parent: &p, foo = 3, bar.baz = 3,);
|
||||
trace!(target: "foo_events", parent: &p, "foo");
|
||||
trace!(target: "foo_events", parent: &p, "foo: {}", 3);
|
||||
trace!(target: "foo_events", parent: &p, { foo = 3, bar.baz = 80 }, "quux");
|
||||
trace!(target: "foo_events", parent: &p, { foo = 3, bar.baz = 80 }, "quux");
|
||||
trace!(target: "foo_events", parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
|
||||
trace!(target: "foo_events", parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
|
||||
trace!(target: "foo_events", parent: &p, { foo = 2, bar.baz = 78, }, "quux");
|
||||
trace!(target: "foo_events", parent: &p, { foo = 2, bar.baz = 78, }, "quux");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
x
Reference in New Issue
Block a user