aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/abstract_controller/logger.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-09-16 22:34:44 -0500
committerJoshua Peek <josh@joshpeek.com>2009-09-16 22:34:44 -0500
commit23e72d4cc8d879e4d3facac31f96643da48a8a27 (patch)
tree280ceaac16d760d4619625564e47e9d5591e91bd /actionpack/lib/abstract_controller/logger.rb
parent6be6fae59ab57499454ab3c071a3fea54e560f38 (diff)
downloadrails-23e72d4cc8d879e4d3facac31f96643da48a8a27.tar.gz
rails-23e72d4cc8d879e4d3facac31f96643da48a8a27.tar.bz2
rails-23e72d4cc8d879e4d3facac31f96643da48a8a27.zip
Forward all methods to delayed log
Diffstat (limited to 'actionpack/lib/abstract_controller/logger.rb')
-rw-r--r--actionpack/lib/abstract_controller/logger.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/actionpack/lib/abstract_controller/logger.rb b/actionpack/lib/abstract_controller/logger.rb
index 1b879b963b..06b64d5cb2 100644
--- a/actionpack/lib/abstract_controller/logger.rb
+++ b/actionpack/lib/abstract_controller/logger.rb
@@ -11,15 +11,17 @@ module AbstractController
# just discard the String if the log level is too low.
#
# TODO: Require that Rails loggers accept a block.
- class DelayedLog
- def initialize(&blk)
- @blk = blk
+ class DelayedLog < ActiveSupport::BasicObject
+ def initialize(&block)
+ @str, @block = nil, block
end
- def to_s
- @blk.call
+ def method_missing(*args, &block)
+ unless @str
+ @str, @block = @block.call, nil
+ end
+ @str.send(*args, &block)
end
- alias to_str to_s
end
included do