diff options
author | José Valim <jose.valim@gmail.com> | 2009-12-26 20:28:53 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-12-26 20:28:53 +0100 |
commit | 75ba102a80965b2612df0253d1278581a88b8d66 (patch) | |
tree | 435658d7914821be2e745bf3468139cf6a753a07 /actionpack/lib/action_controller/metal/filter_parameter_logging.rb | |
parent | 8a36e907d2a0a28be1fa8334221cc2e195d75168 (diff) | |
download | rails-75ba102a80965b2612df0253d1278581a88b8d66.tar.gz rails-75ba102a80965b2612df0253d1278581a88b8d66.tar.bz2 rails-75ba102a80965b2612df0253d1278581a88b8d66.zip |
Remove ActionView inline logging to ActiveSupport::Notifications and create ActionController::Base#log_event, so everything can be logged within one listener. Also expose log_process_action as a hook for different modules to include their own information during the action processing. This allow ActiveRecord to hook and any other ORM. Finally, this commit changes 'Processing' and 'Rendering' in logs to 'Processed' and 'Rendered' because at the point it's logged, everying already happened.
Diffstat (limited to 'actionpack/lib/action_controller/metal/filter_parameter_logging.rb')
-rw-r--r-- | actionpack/lib/action_controller/metal/filter_parameter_logging.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/actionpack/lib/action_controller/metal/filter_parameter_logging.rb b/actionpack/lib/action_controller/metal/filter_parameter_logging.rb index a53c052075..59e200396a 100644 --- a/actionpack/lib/action_controller/metal/filter_parameter_logging.rb +++ b/actionpack/lib/action_controller/metal/filter_parameter_logging.rb @@ -2,8 +2,6 @@ module ActionController module FilterParameterLogging extend ActiveSupport::Concern - include AbstractController::Logger - module ClassMethods # Replace sensitive parameter data from the request log. # Filters parameters that have any of the arguments as a substring. @@ -54,23 +52,25 @@ module ActionController end protected :filter_parameters end - end - INTERNAL_PARAMS = [:controller, :action, :format, :_method, :only_path] + protected - def process(*) - response = super - if logger - parameters = filter_parameters(params).except!(*INTERNAL_PARAMS) - logger.info { " Parameters: #{parameters.inspect}" } unless parameters.empty? + # Overwrite log_process_action to include parameters information. + # If this method is invoked, it means logger is defined, so don't + # worry with such scenario here. + def log_process_action(controller) #:nodoc: + params = controller.send(:filter_parameters, controller.request.params) + logger.info " Parameters: #{params.inspect}" unless params.empty? + super end - response end + INTERNAL_PARAMS = [:controller, :action, :format, :_method, :only_path] + protected def filter_parameters(params) - params.dup + params.dup.except!(*INTERNAL_PARAMS) end end |