Method: Foreman::Engine::CLI#output

Defined in:
lib/foreman/engine/cli.rb

#output(name, data) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/foreman/engine/cli.rb', line 56

def output(name, data)
  data.to_s.lines.map(&:chomp).each do |message|
    output  = ""
    output += $stdout.color(@colors[name.split(".").first].to_sym)
    output += "#{Time.now.strftime("%H:%M:%S")} " if options[:timestamp]
    output += "#{pad_process_name(name)} | "
    output += $stdout.color(:reset)
    output += message
    $stdout.puts output
    $stdout.flush
  end
rescue Errno::EPIPE
  terminate_gracefully
end