Skip to content
This repository
Browse code

Simplified the logging format for parameters (don't include controlle…

…r, action, and format as duplicates) [DHH]
  • Loading branch information...
commit 62ffc6e4db1eecfe5c5a5f7471a9c39d665ada56 1 parent fbe387e
David Heinemeier Hansson authored November 01, 2008
2  actionpack/CHANGELOG
... ...
@@ -1,5 +1,7 @@
1 1
 *2.2.1 [RC2 or 2.2 final]*
2 2
 
  3
+* Simplified the logging format for parameters (don't include controller, action, and format as duplicates) [DHH]
  4
+
3 5
 * Remove the logging of the Session ID when the session store is CookieStore [DHH]
4 6
 
5 7
 * Fixed regex in redirect_to to fully support URI schemes #1247 [Seth Fitzsimmons]
29  actionpack/lib/action_controller/base.rb
@@ -1225,17 +1225,34 @@ def initialize_current_url
1225 1225
 
1226 1226
       def log_processing
1227 1227
         if logger && logger.info?
1228  
-          logger.info "\n\nProcessing #{self.class.name}\##{action_name} (for #{request_origin}) [#{request.method.to_s.upcase}]"
  1228
+          log_processing_for_request_id
  1229
+          log_processing_for_session_id
  1230
+          log_processing_for_parameters
  1231
+        end
  1232
+      end
  1233
+      
  1234
+      def log_processing_for_request_id
  1235
+        request_id = "\n\nProcessing #{self.class.name}\##{action_name} "
  1236
+        request_id << "to #{params[:format]} " if params[:format]
  1237
+        request_id << "(for #{request_origin}) [#{request.method.to_s.upcase}]"
1229 1238
 
1230  
-          if @_session && @_session.respond_to?(:session_id) &&
1231  
-              !(@_session.respond_to?(:dbman) && @_session.is_a?(CGI::Session::CookieStore))
1232  
-            logger.info "  Session ID: #{@_session.session_id}"
1233  
-          end
  1239
+        logger.info(request_id)
  1240
+      end
1234 1241
 
1235  
-          logger.info "  Parameters: #{respond_to?(:filter_parameters) ? filter_parameters(params).inspect : params.inspect}"
  1242
+      def log_processing_for_session_id
  1243
+        if @_session && @_session.respond_to?(:session_id) && @_session.respond_to?(:dbman) &&
  1244
+            !@_session.dbman.is_a?(CGI::Session::CookieStore)
  1245
+          logger.info "  Session ID: #{@_session.session_id}"
1236 1246
         end
1237 1247
       end
1238 1248
 
  1249
+      def log_processing_for_parameters
  1250
+        parameters = respond_to?(:filter_parameters) ? filter_parameters(params) : params
  1251
+        parameters = parameters.except(:controller, :action, :format)
  1252
+        
  1253
+        logger.info "  Parameters: #{parameters.inspect}"
  1254
+      end
  1255
+
1239 1256
       def default_render #:nodoc:
1240 1257
         render
1241 1258
       end

0 notes on commit 62ffc6e

Please sign in to comment.
Something went wrong with that request. Please try again.