1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/logger] Avoid creating [] and "" when logging an Exception that has no backtrace

https://github.com/ruby/logger/commit/75fd308053
This commit is contained in:
Akira Matsuda 2019-07-31 14:38:38 +09:00 committed by Hiroshi SHIBATA
parent 0aafc32995
commit 6158e28f8d
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2

View file

@ -27,7 +27,7 @@ class Logger
when ::String
msg
when ::Exception
"#{ msg.message } (#{ msg.class })\n#{ (msg.backtrace || []).join("\n") }"
"#{ msg.message } (#{ msg.class })\n#{ msg.backtrace.join("\n") if msg.backtrace }"
else
msg.inspect
end