[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
1 changed files with 1 additions and 1 deletions

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