Permalink
Browse files

Merge pull request #11486 from wolframarnold/3-2-stable_fix_respond_t…

…o_missing_in_tagged_loggging

3-2-stable patch: Add respond_to_missing? in TaggedLoggging
  • Loading branch information...
rafaelfranca committed Jul 18, 2013
2 parents 39441f7 + 803008e commit ed19c02c8de3789cd26178c50246e8e155d5532f
@@ -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) ##
@@ -72,6 +72,10 @@ def method_missing(method, *args)
@logger.send(method, *args)
end
+ def respond_to_missing?(*args)
+ @logger.respond_to? *args
+ end
+
private
def tags_text
tags = current_tags
@@ -66,6 +66,10 @@ def add(severity, message = nil, progname = nil, &block)
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

0 comments on commit ed19c02

Please sign in to comment.