@@ -16,50 +16,51 @@ def start_processing(event)
16
16
end
17
17
18
18
def process_action ( event )
19
- return unless logger . info?
20
-
21
- payload = event . payload
22
- additions = ActionController ::Base . log_process_action ( payload )
23
-
24
- status = payload [ :status ]
25
- if status . nil? && payload [ :exception ] . present?
26
- exception_class_name = payload [ :exception ] . first
27
- status = ActionDispatch ::ExceptionWrapper . status_code_for_exception ( exception_class_name )
19
+ info do
20
+ payload = event . payload
21
+ additions = ActionController ::Base . log_process_action ( payload )
22
+
23
+ status = payload [ :status ]
24
+ if status . nil? && payload [ :exception ] . present?
25
+ exception_class_name = payload [ :exception ] . first
26
+ status = ActionDispatch ::ExceptionWrapper . status_code_for_exception ( exception_class_name )
27
+ end
28
+ message = "Completed #{ status } #{ Rack ::Utils ::HTTP_STATUS_CODES [ status ] } in #{ event . duration . round } ms"
29
+ message << " (#{ additions . join ( " | " ) } )" unless additions . blank?
30
+ message
28
31
end
29
- message = "Completed #{ status } #{ Rack ::Utils ::HTTP_STATUS_CODES [ status ] } in #{ event . duration . round } ms"
30
- message << " (#{ additions . join ( " | " ) } )" unless additions . blank?
31
-
32
- info ( message )
33
32
end
34
33
35
34
def halted_callback ( event )
36
- info ( "Filter chain halted as #{ event . payload [ :filter ] . inspect } rendered or redirected" )
35
+ info { "Filter chain halted as #{ event . payload [ :filter ] . inspect } rendered or redirected" }
37
36
end
38
37
39
38
def send_file ( event )
40
- info ( "Sent file #{ event . payload [ :path ] } (#{ event . duration . round ( 1 ) } ms)" )
39
+ info { "Sent file #{ event . payload [ :path ] } (#{ event . duration . round ( 1 ) } ms)" }
41
40
end
42
41
43
42
def redirect_to ( event )
44
- info ( "Redirected to #{ event . payload [ :location ] } " )
43
+ info { "Redirected to #{ event . payload [ :location ] } " }
45
44
end
46
45
47
46
def send_data ( event )
48
- info ( "Sent data #{ event . payload [ :filename ] } (#{ event . duration . round ( 1 ) } ms)" )
47
+ info { "Sent data #{ event . payload [ :filename ] } (#{ event . duration . round ( 1 ) } ms)" }
49
48
end
50
49
51
50
def unpermitted_parameters ( event )
52
- unpermitted_keys = event . payload [ :keys ]
53
- debug ( "Unpermitted parameter#{ 's' if unpermitted_keys . size > 1 } : #{ unpermitted_keys . join ( ", " ) } " )
51
+ debug do
52
+ unpermitted_keys = event . payload [ :keys ]
53
+ "Unpermitted parameter#{ 's' if unpermitted_keys . size > 1 } : #{ unpermitted_keys . join ( ", " ) } "
54
+ end
54
55
end
55
56
56
57
def deep_munge ( event )
57
- message = "Value for params[: #{ event . payload [ :keys ] . join ( '][:' ) } ] was set " \
58
- "to nil, because it was one of [], [null] or [null, null, ...]. " \
59
- "Go to http://guides.rubyonrails.org/security.html#unsafe-query-generation " \
60
- "for more information. " \
61
-
62
- debug ( message )
58
+ debug do
59
+ "Value for params[: #{ event . payload [ :keys ] . join ( '][:' ) } ] was set " \
60
+ "to nil, because it was one of [], [null] or [null, null, ...]. " \
61
+ "Go to http://guides.rubyonrails.org/security.html#unsafe-query-generation " \
62
+ "for more information." \
63
+ end
63
64
end
64
65
65
66
%w( write_fragment read_fragment exist_fragment?
0 commit comments