From 617ccfd9a34c2859939531d1c130ac2125b616c9 Mon Sep 17 00:00:00 2001 From: Folyd Date: Fri, 11 Jun 2021 18:51:00 +0800 Subject: [PATCH] subscriber: explain why we always call `inner.register_callsite()` before if statement --- tracing-subscriber/src/subscribe.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tracing-subscriber/src/subscribe.rs b/tracing-subscriber/src/subscribe.rs index b4a3cdef97..d196c96f2b 100644 --- a/tracing-subscriber/src/subscribe.rs +++ b/tracing-subscriber/src/subscribe.rs @@ -586,6 +586,9 @@ where return outer; } + // The intention behind calling `inner.register_callsite()` before the if statement + // was to ensure that the inner subscriber is informed that the callsite exists + // regardless of the outer subscriber's filtering decision. let inner = self.inner.register_callsite(metadata); if outer.is_sometimes() { // if this interest is "sometimes", return "sometimes" to ensure that @@ -712,6 +715,9 @@ where return outer; } + // The intention behind calling `inner.register_callsite()` before the if statement + // was to ensure that the inner subscriber is informed that the callsite exists + // regardless of the outer subscriber's filtering decision. let inner = self.inner.register_callsite(metadata); if outer.is_sometimes() { // if this interest is "sometimes", return "sometimes" to ensure that