aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-07-18 10:46:52 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-07-18 10:46:52 -0700
commited19c02c8de3789cd26178c50246e8e155d5532f (patch)
tree59ae31066b52c537a2663eae7fba3698d4b12e05 /activesupport
parent39441f78e3a4bda8774b0a94214ac53dafb6ee8a (diff)
parent803008eb97487614e865ba3428ca2658dc11901b (diff)
downloadrails-ed19c02c8de3789cd26178c50246e8e155d5532f.tar.gz
rails-ed19c02c8de3789cd26178c50246e8e155d5532f.tar.bz2
rails-ed19c02c8de3789cd26178c50246e8e155d5532f.zip
Merge pull request #11486 from wolframarnold/3-2-stable_fix_respond_to_missing_in_tagged_loggging
3-2-stable patch: Add respond_to_missing? in TaggedLoggging
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/CHANGELOG.md4
-rw-r--r--activesupport/lib/active_support/tagged_logging.rb4
-rw-r--r--activesupport/test/tagged_logging_test.rb4
3 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index 20579e44d3..4753977eaa 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -27,6 +27,10 @@
*Andrew White*
+* Add respond_to_missing? for TaggedLogging which is best practice when overriding method_missing. This permits
+ wrapping TaggedLogging by another log abstraction such as em-logger.
+
+ *Wolfram Arnold*
## Rails 3.2.13 (Mar 18, 2013) ##
diff --git a/activesupport/lib/active_support/tagged_logging.rb b/activesupport/lib/active_support/tagged_logging.rb
index 6fff3bc0d4..4b23a1399c 100644
--- a/activesupport/lib/active_support/tagged_logging.rb
+++ b/activesupport/lib/active_support/tagged_logging.rb
@@ -72,6 +72,10 @@ module ActiveSupport
@logger.send(method, *args)
end
+ def respond_to_missing?(*args)
+ @logger.respond_to? *args
+ end
+
private
def tags_text
tags = current_tags
diff --git a/activesupport/test/tagged_logging_test.rb b/activesupport/test/tagged_logging_test.rb
index 91c311ba16..89417ac5cb 100644
--- a/activesupport/test/tagged_logging_test.rb
+++ b/activesupport/test/tagged_logging_test.rb
@@ -66,6 +66,10 @@ class TaggedLoggingTest < ActiveSupport::TestCase
assert_equal "[BCX] Funky time\n", @output.string
end
+ test "correctly answers responds_to_missing? for methods on logger instance" do
+ assert @logger.respond_to?(:debug?)
+ end
+
test "tagged once with blank and nil" do
@logger.tagged(nil, "", "New") { @logger.info "Funky time" }
assert_equal "[New] Funky time\n", @output.string