Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure all strings with spaces are quoted in logs
The current logic covers the case when the log data is already a `String` instance, but not when the data is some other object that, when interpolated into the log string, results in a string containing spaces. The example that led me here is where an exception is logged and the exception's message contains spaces. The exception gets interpolated into the string and has `to_s` called on it. [`Exception#to_s`](https://ruby-doc.org/core-2.6.5/Exception.html#method-i-to_s) returns the message, so the message (with its spaces) go into the log line, but it's bypassed the logic that adds quotes. I used `"#{v}"` instead of `v.to_s` because it seems there is a [subtle difference in their behaviour](https://github.com/ruby/spec/blob/master/language/string_spec.rb#L147-L158), to cover the rare case where `to_s` doesn't return a string. I think we want to keep the existing behaviour here.
- Loading branch information