Sha256: 2b05ec633c3970e18ce2d13bac0d96296a7d79a2d8632c0f3ea648c20cfdefa3

Contents?: true

Size: 829 Bytes

Versions: 9

Compression:

Stored size: 829 Bytes

Contents

require "resque"
require "resque/failure/multiple"
require "resque/failure/redis"
require "resque/failure/multiple"

module Hippo
    class Job
        class FailureLogger < ::Resque::Failure::Base

            def self.configure
                Resque::Failure::Multiple.configure do |multi|
                    # Always stores failure in Redis and writes to log
                    multi.classes = Resque::Failure::Redis, self
                end
            end

            def save
                Hippo.logger.error detailed
            end

            def detailed
                <<-EOF
#{worker} failed processing #{queue}:
Payload:
#{payload.inspect.split("\n").map { |l| "  " + l }.join("\n")}
Exception:
#{exception}
#{exception.backtrace.map { |l| "  " + l }.join("\n")}
EOF
            end
        end
    end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hippo-fw-0.9.9 lib/hippo/job/failure_logger.rb
hippo-fw-0.9.8 lib/hippo/job/failure_logger.rb
hippo-fw-0.9.7 lib/hippo/job/failure_logger.rb
hippo-fw-0.9.6 lib/hippo/job/failure_logger.rb
hippo-fw-0.9.5 lib/hippo/job/failure_logger.rb
hippo-fw-0.9.4 lib/hippo/job/failure_logger.rb
hippo-fw-0.9.3 lib/hippo/job/failure_logger.rb
hippo-fw-0.9.2 lib/hippo/job/failure_logger.rb
hippo-fw-0.9.1 lib/hippo/job/failure_logger.rb