From 3baffd31bea7a4e2bc6bb9892f867d5d7366c468 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Sat, 17 Dec 2022 16:58:39 +0900 Subject: [PATCH] Optimize for the default case where TaggedLogger takes only one tag name --- activesupport/lib/active_support/tagged_logging.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/tagged_logging.rb b/activesupport/lib/active_support/tagged_logging.rb index 0aaf36501f..c510515f99 100644 --- a/activesupport/lib/active_support/tagged_logging.rb +++ b/activesupport/lib/active_support/tagged_logging.rb @@ -33,7 +33,12 @@ def call(severity, timestamp, progname, msg) end def tagged(*tags) - new_tags = push_tags(*tags) + new_tags = if tags.length == 1 + current_tags << tags[0] unless tags[0].blank? + tags + else + push_tags(*tags) + end yield self ensure pop_tags(new_tags.size)