File tree Expand file tree Collapse file tree 2 files changed +2
-24
lines changed
lib/rails_semantic_logger/extensions/action_dispatch Expand file tree Collapse file tree 2 files changed +2
-24
lines changed Original file line number Diff line number Diff line change @@ -7,11 +7,9 @@ class DebugExceptions
77
88 undef_method :log_error
99 if ( Rails ::VERSION ::MAJOR == 7 && Rails ::VERSION ::MINOR >= 1 ) || Rails ::VERSION ::MAJOR > 7
10- def log_error ( request , wrapper )
10+ def log_error ( _request , wrapper )
1111 Rails . application . deprecators . silence do
12- return if !log_rescued_responses? ( request ) && wrapper . rescue_response?
13-
14- level = request . get_header ( "action_dispatch.debug_exception_log_level" )
12+ level = wrapper . respond_to? ( :rescue_response? ) && wrapper . rescue_response? ? :debug : :fatal
1513 ActionController ::Base . logger . log ( level , wrapper . exception )
1614 end
1715 end
Original file line number Diff line number Diff line change @@ -141,26 +141,6 @@ class ArticlesControllerTest < ActionDispatch::IntegrationTest
141141 assert_equal 4 , messages . count , messages
142142 assert_kind_of ActiveRecord ::RecordNotFound , messages [ 3 ] . exception
143143 end
144-
145- it "raises and does not log exception when action_dispatch.log_rescued_responses is false" do
146- # we're testing ActionDispatch::DebugExceptions here too
147- messages = semantic_logger_events do
148- old_show = Rails . application . env_config [ "action_dispatch.show_exceptions" ]
149- old_log_rescued_responses = Rails . application . env_config [ "action_dispatch.log_rescued_responses" ]
150-
151- begin
152- Rails . application . env_config [ "action_dispatch.show_exceptions" ] = :all
153- Rails . application . env_config [ "action_dispatch.log_rescued_responses" ] = false
154- get article_url ( :show )
155- rescue ActiveRecord ::RecordNotFound => e
156- # expected
157- ensure
158- Rails . application . env_config [ "action_dispatch.show_exceptions" ] = old_show
159- Rails . application . env_config [ "action_dispatch.log_rescued_responses" ] = old_log_rescued_responses
160- end
161- end
162- assert_equal 3 , messages . count , messages
163- end
164144 end
165145 end
166146end
You can’t perform that action at this time.
0 commit comments