Module: Thin::Logging
- Defined in:
- lib/http_double/thin_logging.rb
Overview
This patch prevents Thin’s logger from wigging out when you feed it binary data.
Class Method Summary collapse
Class Method Details
.trace_msg(msg) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/http_double/thin_logging.rb', line 7 def trace_msg(msg) source = msg.split "\r\n" result = [] result << source.shift while source.first =~ /\A[[:print:]]+\z/ result << source.shift if source.first == '' if source.index { |line| line =~ /[^[:print:]]/ } result << '[Binary body, %s byte(s)]' % source.join("\r\n").length else result.push *source end trace_msg_raw result.join "\n" end |
.trace_msg_raw ⇒ Object
5 |
# File 'lib/http_double/thin_logging.rb', line 5 alias_method :trace_msg_raw, :trace_msg |