lib/rack/common_logger.rb in rack-2.2.3 vs lib/rack/common_logger.rb in rack-2.2.3.1
- old
+ new
@@ -58,10 +58,13 @@
env[SERVER_PROTOCOL],
status.to_s[0..3],
length,
Utils.clock_time - began_at ]
+ msg.gsub!(/[^[:print:]\n]/) { |c| "\\x#{c.ord}" }
+
logger = @logger || env[RACK_ERRORS]
+
# Standard library logger doesn't support write but it supports << which actually
# calls to write on the log device without formatting
if logger.respond_to?(:write)
logger.write(msg)
else