9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/resque/plugins/custom_logger.rb', line 9
def before_perform(*args)
case args.class.name
when "Array"
if args.first.is_a?(Hash)
data = args.first.merge({:worker_class => self.to_s})
else
data = {:worker_class => self.to_s, :args => args.to_json}
end
when "Hash"
data = args.merge({:worker_class => self.to_s})
end
if Rails.logger.is_a?(Ougai::Logger) && !Rails.env.development?
Rails.logger.with_fields = { zecs_service: data.transform_keys(&:to_sym), trace_id: SecureRandom.uuid }
end
if data.present?
Rails.logger.info('Starting job')
end
end
|