Class: ActiveJob::Logging::LogSubscriber
- Inherits:
-
ActiveSupport::LogSubscriber
- Object
- ActiveSupport::LogSubscriber
- ActiveJob::Logging::LogSubscriber
- Defined in:
- lib/active_job/logging.rb
Overview
:nodoc:
Instance Method Summary collapse
- #discard(event) ⇒ Object
- #enqueue(event) ⇒ Object
- #enqueue_at(event) ⇒ Object
- #enqueue_retry(event) ⇒ Object
- #perform(event) ⇒ Object
- #perform_start(event) ⇒ Object
- #retry_stopped(event) ⇒ Object
Instance Method Details
#discard(event) ⇒ Object
114 115 116 117 118 119 120 121 |
# File 'lib/active_job/logging.rb', line 114 def discard(event) job = event.payload[:job] ex = event.payload[:error] error do "Discarded #{job.class} due to a #{ex.class}." end end |
#enqueue(event) ⇒ Object
56 57 58 59 60 61 |
# File 'lib/active_job/logging.rb', line 56 def enqueue(event) info do job = event.payload[:job] "Enqueued #{job.class.name} (Job ID: #{job.job_id}) to #{queue_name(event)}" + args_info(job) end end |
#enqueue_at(event) ⇒ Object
63 64 65 66 67 68 |
# File 'lib/active_job/logging.rb', line 63 def enqueue_at(event) info do job = event.payload[:job] "Enqueued #{job.class.name} (Job ID: #{job.job_id}) to #{queue_name(event)} at #{scheduled_at(event)}" + args_info(job) end end |
#enqueue_retry(event) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/active_job/logging.rb', line 91 def enqueue_retry(event) job = event.payload[:job] ex = event.payload[:error] wait = event.payload[:wait] info do if ex "Retrying #{job.class} in #{wait.to_i} seconds, due to a #{ex.class}." else "Retrying #{job.class} in #{wait.to_i} seconds." end end end |
#perform(event) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/active_job/logging.rb', line 77 def perform(event) job = event.payload[:job] ex = event.payload[:exception_object] if ex error do "Error performing #{job.class.name} (Job ID: #{job.job_id}) from #{queue_name(event)} in #{event.duration.round(2)}ms: #{ex.class} (#{ex.}):\n" + Array(ex.backtrace).join("\n") end else info do "Performed #{job.class.name} (Job ID: #{job.job_id}) from #{queue_name(event)} in #{event.duration.round(2)}ms" end end end |
#perform_start(event) ⇒ Object
70 71 72 73 74 75 |
# File 'lib/active_job/logging.rb', line 70 def perform_start(event) info do job = event.payload[:job] "Performing #{job.class.name} (Job ID: #{job.job_id}) from #{queue_name(event)} enqueued at #{job.enqueued_at}" + args_info(job) end end |
#retry_stopped(event) ⇒ Object
105 106 107 108 109 110 111 112 |
# File 'lib/active_job/logging.rb', line 105 def retry_stopped(event) job = event.payload[:job] ex = event.payload[:error] error do "Stopped retrying #{job.class} due to a #{ex.class}, which reoccurred on #{job.executions} attempts." end end |