Class: Para::Logging::ActiveJobLogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/para/logging/active_job_log_subscriber.rb

Instance Method Summary collapse

Instance Method Details

#failed(event) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/para/logging/active_job_log_subscriber.rb', line 4

def failed(event)
  fatal do
    job = event.payload[:job]
    buffer = []
    buffer << "#{ job.class.name } (Job ID: #{ job.job_id }) failed" + args_info(job)
    buffer << ''
    buffer << [event.payload[:exception].class, event.payload[:exception].message].join(' - ')
    buffer << ''
    buffer << '-------------------'
    buffer << ''
    buffer += event.payload[:exception].backtrace
    buffer << ''
    buffer.compact.join("\n")
  end
end