aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/tagged_logging.rb
diff options
context:
space:
mode:
authorFND <fnd@fnd-oda.localdomain>2012-03-19 10:44:20 +0100
committerFND <fnd@fnd-oda.localdomain>2012-03-19 10:49:27 +0100
commite0ee14ed2305a0b2e6ee53c5d5a98450d2f534e4 (patch)
tree51d726d54ea148da6db030bf54a3bc15af8d2573 /activesupport/lib/active_support/tagged_logging.rb
parent24d244c1bc1a744de599df18d74c9b343fd4c9fe (diff)
downloadrails-e0ee14ed2305a0b2e6ee53c5d5a98450d2f534e4.tar.gz
rails-e0ee14ed2305a0b2e6ee53c5d5a98450d2f534e4.tar.bz2
rails-e0ee14ed2305a0b2e6ee53c5d5a98450d2f534e4.zip
Provide access to logger instance within TaggedLogging blocks
this improves encapsulation, simplifying occurrences like the following: Rails.logger.tagged("DEBUG") { Rails.logger.debug(msg) } ... by removing the need to rely on (i.e. repeat) outer variables: Rails.logger.tagged("DEBUG") { |logger| logger.debug(msg) }
Diffstat (limited to 'activesupport/lib/active_support/tagged_logging.rb')
-rw-r--r--activesupport/lib/active_support/tagged_logging.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/tagged_logging.rb b/activesupport/lib/active_support/tagged_logging.rb
index 88fd438448..538a36f6d9 100644
--- a/activesupport/lib/active_support/tagged_logging.rb
+++ b/activesupport/lib/active_support/tagged_logging.rb
@@ -45,7 +45,7 @@ module ActiveSupport
tags = formatter.current_tags
new_tags = new_tags.flatten.reject(&:blank?)
tags.concat new_tags
- yield
+ yield self
ensure
tags.pop(new_tags.size)
end