1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Reformat the logging line and ensure we are logging the serialized args

This commit is contained in:
David Heinemeier Hansson 2014-05-20 17:36:17 +02:00
parent 3649ebc8b4
commit 1d519aae29
2 changed files with 9 additions and 7 deletions

View file

@ -11,8 +11,9 @@ module ActiveJob
# The return value is adapter-specific and may change in a future
# ActiveJob release.
def enqueue(*args)
ActiveSupport::Notifications.instrument "enqueue.active_job", adapter: queue_adapter, job: self, params: args
queue_adapter.queue self, *Parameters.serialize(args)
serialized_args = Parameters.serialize(args)
ActiveSupport::Notifications.instrument "enqueue.active_job", adapter: queue_adapter, job: self, args: serialized_args
queue_adapter.queue self, *serialized_args
end
end
end

View file

@ -1,12 +1,13 @@
require 'active_support/core_ext/string/filters'
module ActiveJob
class LogSubscriber < ActiveSupport::LogSubscriber
def enqueue(event)
payload = event.payload
params = payload[:params]
adapter = payload[:adapter]
job = payload[:job]
queue_name = event.payload[:adapter].name.demodulize.remove('Adapter')
job_name = event.payload[:job].name
args = event.payload[:args].any? ? ": #{event.payload[:args].inspect}" : ""
info "ActiveJob enqueued to #{adapter.name.demodulize} job #{job.name}: #{params.inspect}"
info "Enqueued #{job_name} to #{queue_name}" + args
end
def logger