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.



17
18
19
# File 'lib/qless/middleware/sentry.rb', line 17

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

Instance Method Details

#logObject



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

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

  safely_send event
end