Module: Resque::Plugins::RestashLogger
- Defined in:
- lib/restash_rails/resque/plugins/restash_logger.rb
Instance Method Summary collapse
-
#after_enqueue_logstash_logger(*args) ⇒ Object
Executed on the enqueueing instance.
- #after_perform_logstash_logger(*args) ⇒ Object
- #after_schedule_send_monitor_data(*args) ⇒ Object
-
#before_perform_logstash_logger(*args) ⇒ Object
Executed on the Resque worker.
- #log(log_message, args, severity = :info) ⇒ Object
- #on_failure_logstash_logger(*args) ⇒ Object
Instance Method Details
#after_enqueue_logstash_logger(*args) ⇒ Object
Executed on the enqueueing instance
19 20 21 |
# File 'lib/restash_rails/resque/plugins/restash_logger.rb', line 19 def after_enqueue_logstash_logger(*args) log 'Enqueued', args end |
#after_perform_logstash_logger(*args) ⇒ Object
10 11 12 |
# File 'lib/restash_rails/resque/plugins/restash_logger.rb', line 10 def after_perform_logstash_logger(*args) log 'Finished', args end |
#after_schedule_send_monitor_data(*args) ⇒ Object
23 24 25 |
# File 'lib/restash_rails/resque/plugins/restash_logger.rb', line 23 def after_schedule_send_monitor_data(*args) log 'Scheduled', args end |
#before_perform_logstash_logger(*args) ⇒ Object
Executed on the Resque worker
5 6 7 8 |
# File 'lib/restash_rails/resque/plugins/restash_logger.rb', line 5 def before_perform_logstash_logger(*args) @resque_job_uuid = SecureRandom.uuid log 'Executing', args end |
#log(log_message, args, severity = :info) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/restash_rails/resque/plugins/restash_logger.rb', line 27 def log(, args, severity = :info) log_arguments = { log_message: , extra_data: args, class: self.name, log_tag: :resque_hooks } if args.is_a?(Array) && args[0].is_a?(Exception) exception = args.shift log_arguments[:exception] = { class: exception.class, message: exception., backtrace: exception.backtrace } end log_arguments[:resque_job_uuid] = @resque_job_uuid if @resque_job_uuid.present? Rails.logger.send(severity, log_arguments) end |
#on_failure_logstash_logger(*args) ⇒ Object
14 15 16 |
# File 'lib/restash_rails/resque/plugins/restash_logger.rb', line 14 def on_failure_logstash_logger(*args) log 'Failed', args, :error end |