diff options
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/tagged_logging.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/tagged_logging.rb b/activesupport/lib/active_support/tagged_logging.rb index d8a86d997e..75a7ca24c2 100644 --- a/activesupport/lib/active_support/tagged_logging.rb +++ b/activesupport/lib/active_support/tagged_logging.rb @@ -32,15 +32,18 @@ module ActiveSupport def push_tags(*tags) tags.flatten.reject(&:blank?).tap do |new_tags| + @tags_text = nil current_tags.concat new_tags end end def pop_tags(size = 1) + @tags_text = nil current_tags.pop size end def clear_tags! + @tags_text = nil current_tags.clear end @@ -51,11 +54,13 @@ module ActiveSupport end def tags_text - tags = current_tags - if tags.one? - "[#{tags[0]}] " - elsif tags.any? - tags.collect { |tag| "[#{tag}] " }.join + @tags_text ||= begin + tags = current_tags + if tags.one? + "[#{tags[0]}] " + elsif tags.any? + tags.collect { |tag| "[#{tag}] " }.join + end end end end |