diff options
Diffstat (limited to 'lib/active_job/log_subscriber.rb')
-rw-r--r-- | lib/active_job/log_subscriber.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/active_job/log_subscriber.rb b/lib/active_job/log_subscriber.rb new file mode 100644 index 0000000000..81859d8da1 --- /dev/null +++ b/lib/active_job/log_subscriber.rb @@ -0,0 +1,19 @@ +module ActiveJob + class LogSubscriber < ActiveSupport::LogSubscriber + + def enqueue(event) + payload = event.payload + params = payload[:params] + adapter = payload[:adapter] + job = payload[:job] + + info "ActiveJob enqueued to #{adapter.name.demodulize} job #{job.name}: #{params.inspect}" + end + + def logger + ActiveJob::Base.logger + end + end +end + +ActiveJob::LogSubscriber.attach_to :active_job |