Sha256: 3cc6e26c7c12ba76e436d76b170a057b10cd943f505d0e5776843a564c00b7eb
Contents?: true
Size: 904 Bytes
Versions: 64
Compression:
Stored size: 904 Bytes
Contents
# This Resque extension changes the resque default logger to monologger # and formats the log in json format. # # Monologger supports printing logs in trap block. # module Resque module Plugins module CustomLogger 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 end end end
Version data entries
64 entries across 64 versions & 1 rubygems