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

Backport #990 (subscriber: warn if trying to enable a statically disabled level) #1021

Merged
merged 2 commits into from
Oct 7, 2020

Conversation

jyn514
Copy link
Contributor

@jyn514 jyn514 commented Oct 7, 2020

This backports #990 so it can be used in rustc without having to upgrade to a new breaking version.

…io-rs#990)


## Motivation


Fixes tokio-rs#975.

## Solution

This implements the warning in `tracing-subscriber` only, as mentioned
in
tokio-rs#975 (comment).
It warns whenever directives are parsed, including programmatically and
through environment variables. It does not include the suggested new API
which returns the filters that wouldn't be parsed.

- List filters that would be ignored
- Mention 'static max level'
- Describe how to enable the logging

Example output:

```
$ RUST_LOG=off,debug,silenced[x]=trace cargo run -q
warning: some trace filter directives would enable traces that are disabled statically
 | `debug` would enable the DEBUG level for all targets
 | `silenced[x]=trace` would enable the TRACE level for the `silenced` target
 = note: the static max level is info
 = note: to enable DEBUG logging, remove the `max_level_info` feature
```
![image](https://user-images.githubusercontent.com/23638587/95243324-77dc6a00-07de-11eb-8ed3-6ee2109940d4.png)
@jyn514 jyn514 requested review from hawkw and a team as code owners October 7, 2020 00:08
@hawkw hawkw merged commit a14ff8d into tokio-rs:v0.1.x Oct 7, 2020
@jyn514 jyn514 deleted the backport-warnings branch October 7, 2020 16:48
hawkw added a commit that referenced this pull request Oct 7, 2020
Changed

- Updated `tracing-core` to 0.1.17 ([#992])

Added

- **env-filter**: Added support for filtering on targets which contain
  dashes ([#1014])
- **env-filter**: Added a warning when creating an `EnvFilter` that
  contains directives that would enable a level disabled by the
  `tracing` crate's `static_max_level` features ([#1021])

Thanks to @jyn514 and @bkchr for contributing to this release!

[#992]: #992
[#1014]: #1014
[#1021]: #1021
hawkw added a commit that referenced this pull request Oct 7, 2020
Changed

- Updated `tracing-core` to 0.1.17 ([#992])

Added

- **env-filter**: Added support for filtering on targets which contain
  dashes ([#1014])
- **env-filter**: Added a warning when creating an `EnvFilter` that
  contains directives that would enable a level disabled by the
  `tracing` crate's `static_max_level` features ([#1021])

Thanks to @jyn514 and @bkchr for contributing to this release!

[#992]: #992
[#1014]: #1014
[#1021]: #1021
hawkw added a commit that referenced this pull request Oct 7, 2020
### Changed

- Updated `tracing-core` to 0.1.17 ([#992])

### Added

- **env-filter**: Added support for filtering on targets which contain
  dashes ([#1014])
- **env-filter**: Added a warning when creating an `EnvFilter` that
  contains directives that would enable a level disabled by the
  `tracing` crate's `static_max_level` features ([#1021])

Thanks to @jyn514 and @bkchr for contributing to this release!

[#992]: #992
[#1014]: #1014
[#1021]: #1021
kaffarell pushed a commit to kaffarell/tracing that referenced this pull request May 22, 2024
### Changed

- Updated `tracing-core` to 0.1.17 ([tokio-rs#992])

### Added

- **env-filter**: Added support for filtering on targets which contain
  dashes ([tokio-rs#1014])
- **env-filter**: Added a warning when creating an `EnvFilter` that
  contains directives that would enable a level disabled by the
  `tracing` crate's `static_max_level` features ([tokio-rs#1021])

Thanks to @jyn514 and @bkchr for contributing to this release!

[tokio-rs#992]: tokio-rs#992
[tokio-rs#1014]: tokio-rs#1014
[tokio-rs#1021]: tokio-rs#1021
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