Skip to content

Commit

Permalink
Merge branch 'v0.1.x' into eliza/linked-list-registry
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Apr 19, 2022
2 parents 3e6fadd + c8a2bb2 commit 251f013
Show file tree
Hide file tree
Showing 59 changed files with 721 additions and 719 deletions.
17 changes: 8 additions & 9 deletions tracing-appender/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//! *Compiler support: [requires `rustc` 1.53+][msrv]*
//!
//! [msrv]: #supported-rust-versions
//! [file_appender]: ./rolling/struct.RollingFileAppender.html
//! [file_appender]: rolling::RollingFileAppender
//! [tracing]: https://docs.rs/tracing/
//!
//! # Usage
Expand Down Expand Up @@ -88,13 +88,12 @@
//!
//! The [`non_blocking` module][non_blocking]'s documentation provides more detail on how to use `non_blocking`.
//!
//! [non_blocking]: ./non_blocking/index.html
//! [write]: https://doc.rust-lang.org/std/io/trait.Write.html
//! [guard]: ./non_blocking/struct.WorkerGuard.html
//! [rolling]: ./rolling/index.html
//! [make_writer]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/trait.MakeWriter.html
//! [rolling_struct]: ./rolling/struct.RollingFileAppender.html
//! [fmt_subscriber]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/struct.Subscriber.html
//! [non_blocking]: mod@non_blocking
//! [write]: std::io::Write
//! [guard]: non_blocking::WorkerGuard
//! [make_writer]: tracing_subscriber::fmt::MakeWriter
//! [rolling_struct]: rolling::RollingFileAppender
//! [fmt_subscriber]: tracing_subscriber::fmt::Subscriber
//!
//! ## Non-Blocking Rolling File Appender
//!
Expand Down Expand Up @@ -166,7 +165,7 @@ pub(crate) mod sync;
///
/// See the [`non_blocking` module's docs][non_blocking]'s for more details.
///
/// [non_blocking]: ./non_blocking/index.html
/// [non_blocking]: mod@non_blocking
///
/// # Examples
///
Expand Down
17 changes: 8 additions & 9 deletions tracing-appender/src/non_blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
//! tracing_appender::non_blocking(std::io::stdout())
//! # }
//! ```
//! [builder]: ./struct.NonBlockingBuilder.html#method.default
//! [builder]: NonBlockingBuilder::default
//!
//! <br/> This function returns a tuple of `NonBlocking` and `WorkerGuard`.
//! `NonBlocking` implements [`MakeWriter`] which integrates with `tracing_subscriber`.
Expand All @@ -33,7 +33,7 @@
//!
//! See [`WorkerGuard`][worker_guard] for examples of using the guard.
//!
//! [worker_guard]: ./struct.WorkerGuard.html
//! [worker_guard]: WorkerGuard
//!
//! # Examples
//!
Expand Down Expand Up @@ -65,7 +65,7 @@ use tracing_subscriber::fmt::MakeWriter;
/// backpressure will be exerted on senders, causing them to block their
/// respective threads until there is available capacity.
///
/// [non-blocking]: ./struct.NonBlocking.html
/// [non-blocking]: NonBlocking
/// Recommended to be a power of 2.
pub const DEFAULT_BUFFERED_LINES_LIMIT: usize = 128_000;

Expand All @@ -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
/// or events may not be written.
///
/// [`NonBlocking`]: ./struct.NonBlocking.html
/// 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` should be assigned in the `main` function or whatever the entrypoint of the program is.
Expand Down Expand Up @@ -121,8 +120,8 @@ pub struct WorkerGuard {
/// 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.
///
/// [make_writer]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/trait.MakeWriter.html
/// [fmt]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/index.html
/// [make_writer]: tracing_subscriber::fmt::MakeWriter
/// [fmt]: mod@tracing_subscriber::fmt
#[derive(Clone, Debug)]
pub struct NonBlocking {
error_counter: ErrorCounter,
Expand All @@ -145,8 +144,8 @@ impl NonBlocking {
/// The returned `NonBlocking` writer will have the [default configuration][default] values.
/// Other configurations can be specified using the [builder] interface.
///
/// [default]: ./struct.NonBlockingBuilder.html#method.default
/// [builder]: ./struct.NonBlockingBuilder.html
/// [default]: NonBlockingBuilder::default
/// [builder]: NonBlockingBuilder
pub fn new<T: Write + Send + Sync + 'static>(writer: T) -> (NonBlocking, WorkerGuard) {
NonBlockingBuilder::default().finish(writer)
}
Expand Down Expand Up @@ -183,7 +182,7 @@ impl NonBlocking {

/// A builder for [`NonBlocking`][non-blocking].
///
/// [non-blocking]: ./struct.NonBlocking.html
/// [non-blocking]: NonBlocking
#[derive(Debug)]
pub struct NonBlockingBuilder {
buffered_lines_limit: usize,
Expand Down
14 changes: 3 additions & 11 deletions tracing-appender/src/rolling.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! A rolling file appender.
//!
//! Creates a new log file at a fixed frequency as defined by [`Rotation`](struct.Rotation.html).
//! Creates a new log file at a fixed frequency as defined by [`Rotation`][self::Rotation].
//! Logs will be written to this file for the duration of the period and will automatically roll over
//! to the newly created log file once the time period has elapsed.
//!
Expand All @@ -17,10 +17,6 @@
//! will be created daily
//! - [`Rotation::never()`][never()]: This will result in log file located at `some_directory/log_file_name`
//!
//! [minutely]: fn.minutely.html
//! [hourly]: fn.hourly.html
//! [daily]: fn.daily.html
//! [never]: fn.never.html
//!
//! # Examples
//!
Expand Down Expand Up @@ -114,7 +110,7 @@ impl RollingFileAppender {
/// Creates a new `RollingFileAppender`.
///
/// A `RollingFileAppender` will have a fixed rotation whose frequency is
/// defined by [`Rotation`](struct.Rotation.html). The `directory` and
/// defined by [`Rotation`][self::Rotation]. The `directory` and
/// `file_name_prefix` arguments determine the location and file name's _prefix_
/// of the log file. `RollingFileAppender` will automatically append the current date
/// and hour (UTC format) to the file name.
Expand All @@ -126,10 +122,6 @@ impl RollingFileAppender {
/// - [`Rotation::daily()`][daily],
/// - [`Rotation::never()`][never()]
///
/// [minutely]: fn.minutely.html
/// [hourly]: fn.hourly.html
/// [daily]: fn.daily.html
/// [never]: fn.never.html
///
/// # Examples
/// ```rust
Expand Down Expand Up @@ -284,7 +276,7 @@ pub fn hourly(
/// a non-blocking, daily file appender.
///
/// A `RollingFileAppender` has a fixed rotation whose frequency is
/// defined by [`Rotation`](struct.Rotation.html). The `directory` and
/// defined by [`Rotation`][self::Rotation]. The `directory` and
/// `file_name_prefix` arguments determine the location and file name's _prefix_
/// of the log file. `RollingFileAppender` automatically appends the current date in UTC.
///
Expand Down
4 changes: 2 additions & 2 deletions tracing-attributes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
//!
//! [`tracing`]: https://crates.io/crates/tracing
//! [span]: https://docs.rs/tracing/latest/tracing/span/index.html
//! [instrument]: attr.instrument.html
//! [instrument]: macro@self::instrument
//!
//! ## Supported Rust Versions
//!
Expand Down Expand Up @@ -501,7 +501,7 @@ mod expand;
/// [`INFO`]: https://docs.rs/tracing/latest/tracing/struct.Level.html#associatedconstant.INFO
/// [empty field]: https://docs.rs/tracing/latest/tracing/field/struct.Empty.html
/// [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]
pub fn instrument(
args: proc_macro::TokenStream,
Expand Down
22 changes: 22 additions & 0 deletions tracing-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
# 0.1.26 (April 14, 2022)

This release adds a `Value` implementation for `Box<T: Value>` to allow
recording boxed values more conveniently. In particular, this should improve
the ergonomics of the implementations for `dyn std::error::Error` trait objects,
including those added in [v0.1.25].

### Added

- `Value` implementation for `Box<T> where T: Value` ([#2071])

### Fixed

- Broken documentation links ([#2068])

Thanks to new contributor @ben0x539 for contributing to this release!


[v0.1.25]: https://github.com/tokio-rs/tracing/releases/tag/tracing-core-0.1.25
[#2071]: https://github.com/tokio-rs/tracing/pull/2071
[#2068]: https://github.com/tokio-rs/tracing/pull/2068

# 0.1.25 (April 12, 2022)

This release adds additional `Value` implementations for `std::error::Error`
Expand Down
26 changes: 13 additions & 13 deletions tracing-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ Core primitives for application-level tracing.
[Documentation][docs-url] | [Chat][discord-url]

[crates-badge]: https://img.shields.io/crates/v/tracing-core.svg
[crates-url]: https://crates.io/crates/tracing-core/0.1.25
[crates-url]: https://crates.io/crates/tracing-core/0.1.26
[docs-badge]: https://docs.rs/tracing-core/badge.svg
[docs-url]: https://docs.rs/tracing-core/0.1.25
[docs-url]: https://docs.rs/tracing-core/0.1.26
[docs-master-badge]: https://img.shields.io/badge/docs-master-blue
[docs-master-url]: https://tracing-rs.netlify.com/tracing_core
[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg
Expand Down Expand Up @@ -79,22 +79,22 @@ The following crate feature flags are available:

```toml
[dependencies]
tracing-core = { version = "0.1.25", default-features = false }
tracing-core = { version = "0.1.26", default-features = false }
```

**Note**:`tracing-core`'s `no_std` support requires `liballoc`.

[`tracing`]: ../tracing
[`span::Id`]: https://docs.rs/tracing-core/0.1.25/tracing_core/span/struct.Id.html
[`Event`]: https://docs.rs/tracing-core/0.1.25/tracing_core/event/struct.Event.html
[`Subscriber`]: https://docs.rs/tracing-core/0.1.25/tracing_core/subscriber/trait.Subscriber.html
[`Metadata`]: https://docs.rs/tracing-core/0.1.25/tracing_core/metadata/struct.Metadata.html
[`Callsite`]: https://docs.rs/tracing-core/0.1.25/tracing_core/callsite/trait.Callsite.html
[`Field`]: https://docs.rs/tracing-core/0.1.25/tracing_core/field/struct.Field.html
[`FieldSet`]: https://docs.rs/tracing-core/0.1.25/tracing_core/field/struct.FieldSet.html
[`Value`]: https://docs.rs/tracing-core/0.1.25/tracing_core/field/trait.Value.html
[`ValueSet`]: https://docs.rs/tracing-core/0.1.25/tracing_core/field/struct.ValueSet.html
[`Dispatch`]: https://docs.rs/tracing-core/0.1.25/tracing_core/dispatcher/struct.Dispatch.html
[`span::Id`]: https://docs.rs/tracing-core/0.1.26/tracing_core/span/struct.Id.html
[`Event`]: https://docs.rs/tracing-core/0.1.26/tracing_core/event/struct.Event.html
[`Subscriber`]: https://docs.rs/tracing-core/0.1.26/tracing_core/subscriber/trait.Subscriber.html
[`Metadata`]: https://docs.rs/tracing-core/0.1.26/tracing_core/metadata/struct.Metadata.html
[`Callsite`]: https://docs.rs/tracing-core/0.1.26/tracing_core/callsite/trait.Callsite.html
[`Field`]: https://docs.rs/tracing-core/0.1.26/tracing_core/field/struct.Field.html
[`FieldSet`]: https://docs.rs/tracing-core/0.1.26/tracing_core/field/struct.FieldSet.html
[`Value`]: https://docs.rs/tracing-core/0.1.26/tracing_core/field/trait.Value.html
[`ValueSet`]: https://docs.rs/tracing-core/0.1.26/tracing_core/field/struct.ValueSet.html
[`Dispatch`]: https://docs.rs/tracing-core/0.1.26/tracing_core/dispatcher/struct.Dispatch.html

## Supported Rust Versions

Expand Down
21 changes: 10 additions & 11 deletions tracing-core/src/callsite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ use self::dispatchers::Dispatchers;
pub trait Callsite: Sync {
/// Sets the [`Interest`] for this callsite.
///
/// [`Interest`]: ../subscriber/struct.Interest.html
/// [`Interest`]: super::subscriber::Interest
fn set_interest(&self, interest: Interest);

/// Returns the [metadata] associated with the callsite.
///
/// [metadata]: ../metadata/struct.Metadata.html
/// [metadata]: super::metadata::Metadata
fn metadata(&self) -> &Metadata<'_>;

/// This method is an *internal implementation detail* of `tracing-core`. It
Expand Down Expand Up @@ -62,17 +62,16 @@ pub trait Callsite: Sync {
///
/// Two `Identifier`s are equal if they both refer to the same callsite.
///
/// [`Callsite`]: ../callsite/trait.Callsite.html
/// [`Callsite`]: super::callsite::Callsite
#[derive(Clone)]
pub struct Identifier(
/// **Warning**: The fields on this type are currently `pub` because it must
/// be able to be constructed statically by macros. However, when `const
/// fn`s are available on stable Rust, this will no longer be necessary.
/// Thus, these fields are *not* considered stable public API, and they may
/// change warning. Do not rely on any fields on `Identifier`. When
/// constructing new `Identifier`s, use the `identify_callsite!` macro or
/// the `Callsite::id` function instead.
// TODO: When `Callsite::id` is a const fn, this need no longer be `pub`.
/// constructing new `Identifier`s, use the `identify_callsite!` macro
/// instead.
#[doc(hidden)]
pub &'static dyn Callsite,
);
Expand Down Expand Up @@ -100,11 +99,11 @@ pub struct DefaultCallsite {
/// implementation at runtime, then it **must** call this function after that
/// value changes, in order for the change to be reflected.
///
/// [`max_level_hint`]: ../subscriber/trait.Subscriber.html#method.max_level_hint
/// [`Callsite`]: ../callsite/trait.Callsite.html
/// [`enabled`]: ../subscriber/trait.Subscriber.html#tymethod.enabled
/// [`Interest::sometimes()`]: ../subscriber/struct.Interest.html#method.sometimes
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
/// [`max_level_hint`]: super::subscriber::Subscriber::max_level_hint
/// [`Callsite`]: super::callsite::Callsite
/// [`enabled`]: super::subscriber::Subscriber#tymethod.enabled
/// [`Interest::sometimes()`]: super::subscriber::Interest::sometimes
/// [`Subscriber`]: super::subscriber::Subscriber
pub fn rebuild_interest_cache() {
CALLSITES.rebuild_interest(DISPATCHERS.rebuilder());
}
Expand Down

0 comments on commit 251f013

Please sign in to comment.