Skip to content

Commit

Permalink
subscriber: prepare to release 0.2.1
Browse files Browse the repository at this point in the history
Changed

- **filter**: `EnvFilter` directive selection now behaves correctly
  (i.e. like `env_logger`) (#583)

Fixed

- **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, 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 (#580)

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
  • Loading branch information
hawkw committed Feb 14, 2020
1 parent d2489fd commit c4545b4
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 20 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ idiomatic `tracing`.)
In order to record trace events, executables have to use a `Subscriber`
implementation compatible with `tracing`. A `Subscriber` implements a way of
collecting trace data, such as by logging it to standard output. [`tracing_subscriber`](https://docs.rs/tracing-subscriber/)'s
[`fmt` module](https://docs.rs/tracing-subscriber/0.2.0-alpha.2/tracing_subscriber/fmt/index.html) provides reasonable defaults.
[`fmt` module](https://docs.rs/tracing-subscriber/0.2.1-alpha.2/tracing_subscriber/fmt/index.html) provides reasonable defaults.
Additionally, `tracing-subscriber` is able to consume messages emitted by `log`-instrumented libraries and modules.

The simplest way to use a subscriber is to call the `set_global_default` function.
Expand Down Expand Up @@ -78,7 +78,7 @@ fn main() {
```toml
[dependencies]
tracing = "0.1"
tracing-subscriber = "0.2.0"
tracing-subscriber = "0.2.1"
```

This subscriber will be used as the default in all threads for the remainder of the duration
Expand Down
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ tracing = { path = "../tracing", version = "0.1"}
tracing-core = { path = "../tracing-core", version = "0.1"}
tracing-error = { path = "../tracing-error" }
tracing-tower = { version = "0.1.0", path = "../tracing-tower" }
tracing-subscriber = { path = "../tracing-subscriber", version = "0.2.0", features = ["json", "chrono"] }
tracing-subscriber = { path = "../tracing-subscriber", version = "0.2.1", features = ["json", "chrono"] }
tracing-futures = { version = "0.2.1", path = "../tracing-futures", features = ["futures-01"] }
tracing-attributes = { path = "../tracing-attributes", version = "0.1.2"}
tracing-log = { path = "../tracing-log", version = "0.1.1", features = ["env_logger"] }
Expand Down
2 changes: 1 addition & 1 deletion nightly-examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ edition = "2018"

[dev-dependencies]
tracing = { path = "../tracing", version = "0.1"}
tracing-subscriber = { version = "0.2.0-alpha.1", path = "../tracing-subscriber", features = ["json"] }
tracing-subscriber = { version = "0.2.1-alpha.1", path = "../tracing-subscriber", features = ["json"] }
tracing-futures = { path = "../tracing-futures", default-features = false, features = ["std-future"] }
futures = "0.3"
tokio = { version = "0.2", features = ["full"] }
Expand Down
4 changes: 2 additions & 2 deletions tracing-error/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ keywords = [
edition = "2018"

[dependencies]
tracing-subscriber = { path = "../tracing-subscriber", version = "0.2.0", default-features = false, features = ["registry", "fmt"] }
tracing-subscriber = { path = "../tracing-subscriber", version = "0.2.1", default-features = false, features = ["registry", "fmt"] }
tracing = { path = "../tracing", version = "0.1"}

[badges]
maintenance = { status = "experimental" }

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]
8 changes: 4 additions & 4 deletions tracing-error/src/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ use tracing_subscriber::{
/// when formatting the fields of each span in a trace. When no formatter is
/// provided, the [default format] is used instead.
///
/// [`Layer`]: https://docs.rs/tracing-subscriber/0.2.0/tracing_subscriber/layer/trait.Layer.html
/// [`Layer`]: https://docs.rs/tracing-subscriber/0.2.1/tracing_subscriber/layer/trait.Layer.html
/// [`SpanTrace`]: ../struct.SpanTrace.html
/// [field formatter]: https://docs.rs/tracing-subscriber/0.2.0/tracing_subscriber/fmt/trait.FormatFields.html
/// [default format]: https://docs.rs/tracing-subscriber/0.2.0/tracing_subscriber/fmt/format/struct.DefaultFields.html
/// [field formatter]: https://docs.rs/tracing-subscriber/0.2.1/tracing_subscriber/fmt/trait.FormatFields.html
/// [default format]: https://docs.rs/tracing-subscriber/0.2.1/tracing_subscriber/fmt/format/struct.DefaultFields.html
pub struct ErrorLayer<S, F = DefaultFields> {
format: F,

Expand Down Expand Up @@ -70,7 +70,7 @@ where
{
/// Returns a new `ErrorLayer` with the provided [field formatter].
///
/// [field formatter]: https://docs.rs/tracing-subscriber/0.2.0/tracing_subscriber/fmt/trait.FormatFields.html
/// [field formatter]: https://docs.rs/tracing-subscriber/0.2.1/tracing_subscriber/fmt/trait.FormatFields.html
pub fn new(format: F) -> Self {
Self {
format,
Expand Down
17 changes: 17 additions & 0 deletions tracing-subscriber/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# 0.2.1 (February 13, 2020)

### Changed

- **filter**: `EnvFilter` directive selection now behaves correctly (i.e. like
`env_logger`) (#583)

### Fixed

- **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,
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
(#580)

# 0.2.0 (February 4, 2020)

### Breaking Changes
Expand Down
2 changes: 1 addition & 1 deletion tracing-subscriber/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tracing-subscriber"
version = "0.2.0"
version = "0.2.1"
authors = [
"Eliza Weisman <eliza@buoyant.io>",
"David Barsky <me@davidbarsky.com>",
Expand Down
2 changes: 1 addition & 1 deletion tracing-subscriber/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Utilities for implementing and composing [`tracing`][tracing] subscribers.
[crates-badge]: https://img.shields.io/crates/v/tracing-subscriber.svg
[crates-url]: https://crates.io/crates/tracing-subscriber
[docs-badge]: https://docs.rs/tracing-subscriber/badge.svg
[docs-url]: https://docs.rs/tracing-subscriber/0.2.0
[docs-url]: https://docs.rs/tracing-subscriber/0.2.1
[docs-master-badge]: https://img.shields.io/badge/docs-master-blue
[docs-master-url]: https://tracing-rs.netlify.com/tracing_subscriber
[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg
Expand Down
14 changes: 6 additions & 8 deletions tracing-subscriber/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
//! [`env_logger` crate]: https://crates.io/crates/env_logger
//! [`parking_lot`]: https://crates.io/crates/parking_lot
//! [`registry`]: registry/index.html
#![doc(html_root_url = "https://docs.rs/tracing-subscriber/0.2.0")]
#![doc(html_root_url = "https://docs.rs/tracing-subscriber/0.2.1")]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![warn(
missing_debug_implementations,
Expand Down Expand Up @@ -121,33 +121,31 @@ use std::default::Default;
/// Tracks the currently executing span on a per-thread basis.
#[derive(Debug)]
pub struct CurrentSpan {
current: thread::Local<Vec<Id>>,
_p: (),
}

impl CurrentSpan {
/// Returns a new `CurrentSpan`.
pub fn new() -> Self {
Self {
current: thread::Local::new(),
_p: ()
}
}

/// Returns the [`Id`](::Id) of the span in which the current thread is
/// executing, or `None` if it is not inside of a span.
pub fn id(&self) -> Option<Id> {
self.current.with(|current| current.last().cloned())?
registry::stack::CONTEXT.with(|cx| cx.borrow().current().cloned())
}

/// Records that the current thread has entered the span with the provided ID.
pub fn enter(&self, span: Id) {
self.current.with(|current| current.push(span));
registry::stack::CONTEXT.with(|cx| cx.borrow_mut().push(id))
}

/// Records that the current thread has exited a span.
pub fn exit(&self) {
self.current.with(|current| {
let _ = current.pop();
});
registry::stack::CONTEXT.with(|cx| cx.borrow_mut().pop())
}
}

Expand Down

0 comments on commit c4545b4

Please sign in to comment.