mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Fix error backtrace debug logging && Do not log request dump if it is not parsed (#2376)
This commit is contained in:
parent
7928173d70
commit
a7349097c8
2 changed files with 19 additions and 2 deletions
|
@ -51,8 +51,8 @@ module Puma
|
|||
|
||||
string_block = []
|
||||
string_block << title(options)
|
||||
string_block << request_dump(req) if req
|
||||
string_block << error_backtrace(options) if error
|
||||
string_block << request_dump(req) if request_parsed?(req)
|
||||
string_block << error.backtrace if error
|
||||
|
||||
ioerr.puts string_block.join("\n")
|
||||
end
|
||||
|
|
|
@ -59,6 +59,23 @@ class TestErrorLogger < Minitest::Test
|
|||
end
|
||||
end
|
||||
|
||||
def test_debug_backtrace_logging
|
||||
with_debug_mode do
|
||||
def dummy_error
|
||||
raise StandardError.new('non-blank')
|
||||
rescue => e
|
||||
Puma::ErrorLogger.stdio.debug(error: e)
|
||||
end
|
||||
|
||||
_, err = capture_io do
|
||||
dummy_error
|
||||
end
|
||||
|
||||
assert_match %r!non-blank!, err
|
||||
assert_match %r!:in `dummy_error'!, err
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def with_debug_mode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue