Sha256: bbac8757758db59502e2ce15aef5b9aac0a0526b4dbe0e063bea49c5b2e46c20

Contents?: true

Size: 942 Bytes

Versions: 24

Compression:

Stored size: 942 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]}:#{payload[:worker_id]}'")
    elsif payload[:action] == "finish"
      print_finish(payload)
    elsif payload[:type] == "crash" || payload[:type] == "exception"
      # TODO: improve logging of these messages
      log(payload)
    else # to be removed
      ap payload
    end
  end

  private

  def print_finish(payload)
    msg = "Finished running '#{payload[:filename]}' at '#{payload[:hostname]}:#{payload[:worker_id]}'"
    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

24 entries across 24 versions & 1 rubygems

Version Path
gorgon-0.11.0 lib/gorgon/originator_logger.rb
gorgon-0.10.5 lib/gorgon/originator_logger.rb
gorgon-0.10.4 lib/gorgon/originator_logger.rb
gorgon-0.10.3 lib/gorgon/originator_logger.rb
gorgon-0.10.2 lib/gorgon/originator_logger.rb
gorgon-0.10.1 lib/gorgon/originator_logger.rb
gorgon-0.10.0 lib/gorgon/originator_logger.rb
gorgon-0.9.0 lib/gorgon/originator_logger.rb
gorgon-0.8.4 lib/gorgon/originator_logger.rb
gorgon-0.8.3 lib/gorgon/originator_logger.rb
gorgon-0.8.2 lib/gorgon/originator_logger.rb
gorgon-0.8.1 lib/gorgon/originator_logger.rb
gorgon-0.8.0 lib/gorgon/originator_logger.rb
gorgon-0.7.1 lib/gorgon/originator_logger.rb
gorgon-0.7.0 lib/gorgon/originator_logger.rb
gorgon-0.7.0.rc4 lib/gorgon/originator_logger.rb
gorgon-0.7.0.rc3 lib/gorgon/originator_logger.rb
gorgon-0.7.0.rc2 lib/gorgon/originator_logger.rb
gorgon-0.7.0.rc1 lib/gorgon/originator_logger.rb
gorgon-0.6.5 lib/gorgon/originator_logger.rb