Class: Qless::Middleware::Sentry::SentryLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/qless/middleware/sentry.rb

Overview

Logs a single exception to Sentry, adding pertinent job info.

Instance Method Summary collapse

Constructor Details

#initialize(exception, job) ⇒ SentryLogger

Returns a new instance of SentryLogger.



19
20
21
# File 'lib/qless/middleware/sentry.rb', line 19

def initialize(exception, job)
  @exception, @job = exception, job
end

Instance Method Details

#logObject



23
24
25
26
27
28
29
# File 'lib/qless/middleware/sentry.rb', line 23

def log
  event = ::Raven::Event.capture_exception(@exception) do |evt|
    evt.extra = { job:  }
  end

  safely_send event
end