Sha256: 649ac6721b478c57a87c0690db360aa255b9d18d98e1077a10a326da13f737a8

Contents?: true

Size: 760 Bytes

Versions: 2

Compression:

Stored size: 760 Bytes

Contents

require 'gorgon/g_logger'

class OriginatorLogger
  include GLogger

  def initialize log_file
    initialize_logger log_file
  end

  def log_message(payload)
    if payload[:action] == "start"
      log("Started running '#{payload[:filename]}' at '#{payload[:hostname]}'")
    elsif payload[:action] == "finish"
      print_finish(payload)
    else # to be removed
      ap payload
    end
  end

  private

  def print_finish(payload)
    msg = "Finished running '#{payload[:filename]}' at '#{payload[:hostname]}'"
    msg << failure_message(payload[:failures]) if payload[:type] == "fail"
    log msg
  end

  def failure_message(failures)
    msg = []
    failures.each do |failure|
      msg << failure
    end
    msg << ''
    msg.join("\n")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gorgon-0.0.2 lib/gorgon/originator_logger.rb
gorgon-0.0.1 lib/gorgon/originator_logger.rb