Module: IuguLogger::JobLogger::ActiveJob
- Defined in:
- lib/iugu_logger/job_logger.rb
Overview
ActiveJob mixin. include in ApplicationJob to capture all jobs.
ActiveJob >= 5 has #executions; we fall back to 1 on Rails 4.2
(platform).
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/iugu_logger/job_logger.rb', line 177 def self.included(base) base.around_perform do |job, block| Adapter.new( job_class: job.class.name, job_id: job.job_id, queue: job.queue_name, source: SOURCE_ACTIVEJOB, attempt: job.respond_to?(:executions) ? job.executions : 1 ).call { block.call } end end |