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

fmt: add support for off filter directives #72

Merged
merged 2 commits into from
Jun 20, 2019
Merged

fmt: add support for off filter directives #72

merged 2 commits into from
Jun 20, 2019

Conversation

hawkw
Copy link
Member

@hawkw hawkw commented Jun 20, 2019

Motivation

The env_logger crate allows log directives ending in off to
disable all logging from a matching target. However,
tokio-trace-fmt's EnvFilter does not.

For example:

ignoring invalid log directive 'linkerd2_proxy::proxy::canonicalize=off'
ignoring invalid log directive 'linkerd2_proxy::proxy::http::router=off' 
ignoring invalid log directive 'linkerd2_proxy::proxy::tcp=off' 

env_logger accepts these directives.

Solution

This branch adds support for directives with off. It was necessary to
reimplement a LevelFilter type, here similar to the one in
tokio-trace, as tokio-trace-fmt only depends on tokio-trace-core.

Fixes: #68

Signed-off-by: Eliza Weisman [email protected]

@hawkw hawkw added kind/feature New feature or request crate/fmt Related to the `tracing-fmt` crate labels Jun 20, 2019
@hawkw hawkw requested a review from LucioFranco June 20, 2019 21:51
@hawkw hawkw self-assigned this Jun 20, 2019
Signed-off-by: Eliza Weisman <[email protected]>
@hawkw hawkw merged commit f8bef30 into master Jun 20, 2019
@LucioFranco
Copy link
Member

Sorry I couldnt get to this earlier! but it looks good!

hawkw added a commit that referenced this pull request Jun 21, 2019
PR #72 introduced a bug in `EnvFilter` where spans and events whose
level is _equal_ to the filter's max level are rejected, rather than
accepted. This branch fixes the comparisons so that filters once again
work as expected.

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request Jun 21, 2019
PR #72 introduced a bug in `EnvFilter` where spans and events whose
level is _equal_ to the filter's max level are rejected, rather than
accepted. This branch fixes the comparisons so that filters once again
work as expected.

Signed-off-by: Eliza Weisman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate/fmt Related to the `tracing-fmt` crate kind/feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fmt: EnvFilter should allow off directives
2 participants