lib/multi_process/logger.rb in multi_process-0.2.0 vs lib/multi_process/logger.rb in multi_process-0.3.0

- old
+ new

@@ -36,10 +36,14 @@ def read(pipe) pipe.gets end + def collapse? + @opts[:collapse].nil? || @opts[:collapse] + end + private def output(process, line, opts = {}) @mutex.synchronize do opts[:delimiter] ||= ' |' name = if opts[:name] @@ -48,10 +52,10 @@ max = @readers.values.map{|h| h[:process] ? h[:process].title.length : 0 }.max process ? process.title.to_s.rjust(max, ' ') : (' ' * max) end io = opts[:io] || @out - if @last_name == name + if @last_name == name && collapse? io.print " #{' ' * name.length} #{opts[:delimiter]} " else io.print " #{name} #{opts[:delimiter]} " end io.puts line