1
0
Fork 0
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:
Slava 2020-09-22 18:35:04 +03:00 committed by GitHub
parent 7928173d70
commit a7349097c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View file

@ -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

View file

@ -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