Skip to content

Commit

Permalink
Optimize for the default case where TaggedLogger takes only one tag name
Browse files Browse the repository at this point in the history
  • Loading branch information
amatsuda committed Dec 17, 2022
1 parent b9beb3e commit 3baffd3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion activesupport/lib/active_support/tagged_logging.rb
Expand Up @@ -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)
Expand Down

0 comments on commit 3baffd3

Please sign in to comment.