require 'multi_json'

class Utracker::StdoutLogger < Utracker::Logger

  protected

  def write(event)
    puts [
      event.datetime.to_s,
      event.service,
      event.description,
      event.message.uuid,
      serialized_content(event.message.content),
    ].join(' ; ')
  end

  def serialized_content(content)
    case content
    when String then content
    when Hash, Array then MultiJson.dump(content)
    else fail "Message content of type '#{content.class}' are not supported."
    end
  end

end

require 'multi_json'

class Utracker::StdoutLogger < Utracker::Logger

  protected

  def write(event)
    STDOUT.puts MultiJson.dump({
      datetime: event.datetime.to_s,
      service: event.service,
      description: event.description,
      uuid: event.message.uuid,
      parent_uuid: event.message.parent_uuid,
      payload: event.message.content,
    })
  end

end

Make the StdoutLogger output JSON.
Make the StdoutLogger output JSON.
