From e8bbf9be0a92227013cc74944386181225c8b180 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Fri, 21 Jun 2019 14:56:36 -0700 Subject: [PATCH] fmt: fix `EnvFilter` rejecting levels equal to the filter level 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 --- tokio-trace-fmt/src/filter/env.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tokio-trace-fmt/src/filter/env.rs b/tokio-trace-fmt/src/filter/env.rs index f0415bf4e9..00b12308b5 100644 --- a/tokio-trace-fmt/src/filter/env.rs +++ b/tokio-trace-fmt/src/filter/env.rs @@ -99,13 +99,13 @@ where impl Filter for EnvFilter { fn callsite_enabled(&self, metadata: &Metadata, _: &Context) -> Interest { - if !self.includes_span_directive && self.max_level <= *metadata.level() { + if !self.includes_span_directive && self.max_level < *metadata.level() { return Interest::never(); } let mut interest = Interest::never(); for directive in self.directives_for(metadata) { - let accepts_level = directive.level > *metadata.level(); + let accepts_level = directive.level >= *metadata.level(); match directive.in_span.as_ref() { // The directive applies to anything within the span described // by this metadata. The span must always be enabled. @@ -129,7 +129,7 @@ impl Filter for EnvFilter { fn enabled<'a>(&self, metadata: &Metadata, ctx: &Context<'a, N>) -> bool { for directive in self.directives_for(metadata) { - let accepts_level = directive.level > *metadata.level(); + let accepts_level = directive.level >= *metadata.level(); match directive.in_span.as_ref() { // The directive applies to anything within the span described // by this metadata. The span must always be enabled.