Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tracing: backport "implement enabled!" #1883

Merged
merged 4 commits into from
Feb 2, 2022

Conversation

guswynn
Copy link
Contributor

@guswynn guswynn commented Feb 1, 2022

backporting #1821

cherry-pick + really small adjustment to get it to compile and pass tests!

guswynn and others added 2 commits February 1, 2022 15:12
## Motivation

Closes: tokio-rs#1668

My usecase is different than the referenced "avoid doing something
expensive to log": I want to guard turning on `debug` mode for an ffi'd
library, based on some `target` that represents the "module" we care
about.

## Solution

The macro is very similar to `event!`, but adds a few simplistic cases,
and generates ever so slightly different code (to return the correct
value always. It also skips anything to do with `tracing-log`. I
considered (and tried), to share the impl between `event!` and
`enabled!`, but must confess I am not good at macros and got stuck. I
think they are sufficiently different, where copied impls, is easier to
read. We already manage 

Also, my project is on the crates.io version, so this would need to be
backported to 0.1, I can help with that with guidance.

Co-authored-by: Eliza Weisman <eliza@buoyant.io>
Co-authored-by: David Barsky <me@davidbarsky.com>
@guswynn guswynn requested review from hawkw and a team as code owners February 1, 2022 23:18
Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all the documentation is still using the v0.2 trait naming, which i believe needs to be updated.

tracing-core/src/metadata.rs Outdated Show resolved Hide resolved
tracing/src/macros.rs Outdated Show resolved Hide resolved
tracing/src/macros.rs Outdated Show resolved Hide resolved
tracing/src/macros.rs Outdated Show resolved Hide resolved
tracing/src/macros.rs Outdated Show resolved Hide resolved
tracing/src/macros.rs Outdated Show resolved Hide resolved
tracing/src/macros.rs Outdated Show resolved Hide resolved
tracing/src/macros.rs Outdated Show resolved Hide resolved
tracing/tests/enabled.rs Outdated Show resolved Hide resolved
tracing/tests/enabled.rs Outdated Show resolved Hide resolved
tracing/tests/enabled.rs Outdated Show resolved Hide resolved
Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me now that CI works again!

@hawkw hawkw merged commit 2c3555b into tokio-rs:v0.1.x Feb 2, 2022
hawkw added a commit that referenced this pull request Feb 4, 2022
# 0.1.22 (February 3, 2022)

This release adds *experimental* support for recording structured field
values using the [`valuable`] crate. See [this blog post][post] for
details on `valuable`.

Note that `valuable` support currently requires `--cfg
tracing_unstable`. See the documentation for details.

### Added

- **field**: Experimental support for recording field values using the
  [`valuable`] crate ([#1608], [#1888], [#1887])
- **field**: Added `ValueSet::record` method ([#1823])
- **subscriber**: `Default` impl for `NoSubscriber` ([#1785])
- **metadata**: New `Kind::HINT` to support the `enabled!` macro in
  `tracing` ([#1883], [#1891])
### Fixed

- Fixed a number of documentation issues ([#1665], [#1692], [#1737])

Thanks to @xd009642, @Skepfyr, @guswynn, @Folyd, and @mbergkvist for
contributing to this release!
hawkw added a commit that referenced this pull request Feb 4, 2022
# 0.1.22 (February 3, 2022)

This release adds *experimental* support for recording structured field
values using the [`valuable`] crate. See [this blog post][post] for
details on `valuable`.

Note that `valuable` support currently requires `--cfg
tracing_unstable`. See the documentation for details.

### Added

- **field**: Experimental support for recording field values using the
  [`valuable`] crate ([#1608], [#1888], [#1887])
- **field**: Added `ValueSet::record` method ([#1823])
- **subscriber**: `Default` impl for `NoSubscriber` ([#1785])
- **metadata**: New `Kind::HINT` to support the `enabled!` macro in
  `tracing` ([#1883], [#1891])
### Fixed

- Fixed a number of documentation issues ([#1665], [#1692], [#1737])

Thanks to @xd009642, @Skepfyr, @guswynn, @Folyd, and @mbergkvist for
contributing to this release!

[`valuable`]: https://crates.io/crates/valuable
[post]: https://tokio.rs/blog/2021-05-valuable
[#1608]: #1608
[#1888]: #1888
[#1887]: #1887
[#1823]: #1823
[#1785]: #1785
[#1883]: #1883
[#1891]: #1891
[#1665]: #1665
[#1692]: #1692
[#1737]: #1737
@guswynn guswynn deleted the backport_enabled branch February 4, 2022 17:10
kaffarell pushed a commit to kaffarell/tracing that referenced this pull request May 22, 2024
Backports tokio-rs#1821 to `v0.1.x`.

## Motivation

Closes: tokio-rs#1668

My usecase is different than the referenced "avoid doing something
expensive to log": I want to guard turning on `debug` mode for an ffi'd
library, based on some `target` that represents the "module" we care
about.

## Solution

The macro is very similar to `event!`, but adds a few simplistic cases,
and generates ever so slightly different code (to return the correct
value always. It also skips anything to do with `tracing-log`. I
considered (and tried), to share the impl between `event!` and
`enabled!`, but must confess I am not good at macros and got stuck. I
think they are sufficiently different, where copied impls, is easier to
read. We already manage 

Co-authored-by: Eliza Weisman <eliza@buoyant.io>
Co-authored-by: David Barsky <me@davidbarsky.com>
kaffarell pushed a commit to kaffarell/tracing that referenced this pull request May 22, 2024
# 0.1.22 (February 3, 2022)

This release adds *experimental* support for recording structured field
values using the [`valuable`] crate. See [this blog post][post] for
details on `valuable`.

Note that `valuable` support currently requires `--cfg
tracing_unstable`. See the documentation for details.

### Added

- **field**: Experimental support for recording field values using the
  [`valuable`] crate ([tokio-rs#1608], [tokio-rs#1888], [tokio-rs#1887])
- **field**: Added `ValueSet::record` method ([tokio-rs#1823])
- **subscriber**: `Default` impl for `NoSubscriber` ([tokio-rs#1785])
- **metadata**: New `Kind::HINT` to support the `enabled!` macro in
  `tracing` ([tokio-rs#1883], [tokio-rs#1891])
### Fixed

- Fixed a number of documentation issues ([tokio-rs#1665], [tokio-rs#1692], [tokio-rs#1737])

Thanks to @xd009642, @Skepfyr, @guswynn, @Folyd, and @mbergkvist for
contributing to this release!

[`valuable`]: https://crates.io/crates/valuable
[post]: https://tokio.rs/blog/2021-05-valuable
[tokio-rs#1608]: tokio-rs#1608
[tokio-rs#1888]: tokio-rs#1888
[tokio-rs#1887]: tokio-rs#1887
[tokio-rs#1823]: tokio-rs#1823
[tokio-rs#1785]: tokio-rs#1785
[tokio-rs#1883]: tokio-rs#1883
[tokio-rs#1891]: tokio-rs#1891
[tokio-rs#1665]: tokio-rs#1665
[tokio-rs#1692]: tokio-rs#1692
[tokio-rs#1737]: tokio-rs#1737
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants