lib/logger.rb in narou-2.9.5 vs lib/logger.rb in narou-3.0.0

- old
+ new

@@ -81,11 +81,16 @@ block.call end $stdout.capturing = false buffer = $stdout.string $stdout = temp_stream - options[:ansicolor_strip] ? strip_color(buffer) : buffer + result = options[:ansicolor_strip] ? strip_color(buffer) : buffer + if $stdout.capturing && !options[:quiet] + # 多段キャプチャ中かつ quite: false の場合は外側にも伝播する + $stdout.string << result + end + result end def strip_color(str) if $disable_color str @@ -149,11 +154,12 @@ def tty? STDERR.tty? end end -def warn(str) +def warn(str, trace = nil) $stdout.warn str + $stdout.warn trace if trace end def error(str) $stdout.error str end