Class: Hippo::Job::FailureLogger

Inherits:
Resque::Failure::Base
  • Object
show all
Defined in:
lib/hippo/job/failure_logger.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configureObject


10
11
12
13
14
15
# File 'lib/hippo/job/failure_logger.rb', line 10

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

Instance Method Details

#detailedObject


21
22
23
24
25
26
27
28
29
30
# File 'lib/hippo/job/failure_logger.rb', line 21

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

#saveObject


17
18
19
# File 'lib/hippo/job/failure_logger.rb', line 17

def save
    Hippo.logger.error detailed
end