summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2019-07-31 14:38:38 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-12-09 19:17:31 +0900
commit6158e28f8d02026e21317d8a0c2cb2115b3a0660 (patch)
treed7ae78c716d62578ca8d5041ddee1e766f31d082
parent0aafc32995b935b6c46c8439a3e2da008cd683fc (diff)
[ruby/logger] Avoid creating [] and "" when logging an Exception that has no backtrace
https://github.com/ruby/logger/commit/75fd308053
-rw-r--r--lib/logger/formatter.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/logger/formatter.rb b/lib/logger/formatter.rb
index 206c35d9fad..852cffe0334 100644
--- a/lib/logger/formatter.rb
+++ b/lib/logger/formatter.rb
@@ -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