From b1debf0797c4cc8ce83095138f3e14e84a570906 Mon Sep 17 00:00:00 2001 From: Tom Tan Date: Wed, 22 Jan 2025 15:10:02 -0800 Subject: [PATCH] Short circuit the event_enabled check (#2533) --- opentelemetry-sdk/src/logs/log_emitter.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/opentelemetry-sdk/src/logs/log_emitter.rs b/opentelemetry-sdk/src/logs/log_emitter.rs index 4d5e950fb5..497cbb6db1 100644 --- a/opentelemetry-sdk/src/logs/log_emitter.rs +++ b/opentelemetry-sdk/src/logs/log_emitter.rs @@ -323,13 +323,10 @@ impl opentelemetry::logs::Logger for Logger { #[cfg(feature = "spec_unstable_logs_enabled")] fn event_enabled(&self, level: Severity, target: &str) -> bool { - let provider = &self.provider; - - let mut enabled = false; - for processor in provider.log_processors() { - enabled = enabled || processor.event_enabled(level, target, self.scope.name().as_ref()); - } - enabled + self.provider + .log_processors() + .iter() + .any(|processor| processor.event_enabled(level, target, self.scope.name().as_ref())) } }