Sha256: cb80489e0d3b4ab7cfa8e48f1ef075f60acb44e11d3d9b408af127c425011613

Contents?: true

Size: 475 Bytes

Versions: 2

Compression:

Stored size: 475 Bytes

Contents

module MessageQueue
  module ErrorHandlers
    class Logger
      include Logging

      def handle(message, consumer, ex)
        prefix = "Message(#{message.message_id || '-'}): "
        logger.error prefix + "error in consumer '#{consumer}'"
        logger.error prefix + "#{ex.class} - #{ex.message}"
        logger.error (['backtrace:'] + ex.backtrace).join("\n")
      end
    end
  end
end

MessageQueue.register_error_handler MessageQueue::ErrorHandlers::Logger.new

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
message_queue-0.1.1 lib/message_queue/error_handlers/logger.rb
message_queue-0.1.0 lib/message_queue/error_handlers/logger.rb