diff options
author | José Valim <jose.valim@gmail.com> | 2009-08-07 16:10:17 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-08-07 16:10:17 +0200 |
commit | dac8927b0576bff89ba3a4fcbf502dffc9b39e89 (patch) | |
tree | 58c25132a52ef5cc56f406f8e2df416c5f2776a6 /actionpack/lib/action_controller/abstract/logger.rb | |
parent | 072c87b532a0bfb334787928248863a2561dc849 (diff) | |
parent | 606e950ccbd02a10f724c73543575a2a4e1ed8cb (diff) | |
download | rails-dac8927b0576bff89ba3a4fcbf502dffc9b39e89.tar.gz rails-dac8927b0576bff89ba3a4fcbf502dffc9b39e89.tar.bz2 rails-dac8927b0576bff89ba3a4fcbf502dffc9b39e89.zip |
Merge branch 'master' of git://github.com/rails/rails into old
Diffstat (limited to 'actionpack/lib/action_controller/abstract/logger.rb')
-rw-r--r-- | actionpack/lib/action_controller/abstract/logger.rb | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/actionpack/lib/action_controller/abstract/logger.rb b/actionpack/lib/action_controller/abstract/logger.rb deleted file mode 100644 index fd33bd2ddd..0000000000 --- a/actionpack/lib/action_controller/abstract/logger.rb +++ /dev/null @@ -1,52 +0,0 @@ -require 'active_support/core_ext/logger' - -module AbstractController - module Logger - extend ActiveSupport::Concern - - # A class that allows you to defer expensive processing - # until the logger actually tries to log. Otherwise, you are - # forced to do the processing in advance, and send the - # entire processed String to the logger, which might - # 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 - end - - def to_s - @blk.call - end - alias to_str to_s - end - - included do - cattr_accessor :logger - end - - # Override process_action in the AbstractController::Base - # to log details about the method. - def process_action(action) - super - - if logger - log = DelayedLog.new do - "\n\nProcessing #{self.class.name}\##{action_name} " \ - "to #{request.formats} " \ - "(for #{request_origin}) [#{request.method.to_s.upcase}]" - end - - logger.info(log) - end - end - - private - def request_origin - # this *needs* to be cached! - # otherwise you'd get different results if calling it more than once - @request_origin ||= "#{request.remote_ip} at #{Time.now.to_s(:db)}" - end - end -end |