Class: ActiveJob::Logging::LogSubscriber

Inherits:
ActiveSupport::LogSubscriber show all
Defined in:
activejob/lib/active_job/logging.rb

Overview

:nodoc:

Constant Summary

Constants inherited from ActiveSupport::LogSubscriber

ActiveSupport::LogSubscriber::BLACK, ActiveSupport::LogSubscriber::BLUE, ActiveSupport::LogSubscriber::BOLD, ActiveSupport::LogSubscriber::CLEAR, ActiveSupport::LogSubscriber::CYAN, ActiveSupport::LogSubscriber::GREEN, ActiveSupport::LogSubscriber::MAGENTA, ActiveSupport::LogSubscriber::RED, ActiveSupport::LogSubscriber::WHITE, ActiveSupport::LogSubscriber::YELLOW

Instance Attribute Summary

Attributes inherited from ActiveSupport::Subscriber

#patterns

Instance Method Summary collapse

Methods inherited from ActiveSupport::LogSubscriber

#finish, flush_all!, log_subscribers, #start

Methods inherited from ActiveSupport::Subscriber

attach_to, #finish, #initialize, method_added, #start, subscribers

Constructor Details

This class inherits a constructor from ActiveSupport::Subscriber

Instance Method Details

#enqueue(event) ⇒ Object


54
55
56
57
58
59
# File 'activejob/lib/active_job/logging.rb', line 54

def enqueue(event)
  info do
    job = event.payload[:job]
    "Enqueued #{job.class.name} (Job ID: #{job.job_id}) to #{queue_name(event)}" + args_info(job)
  end
end

#enqueue_at(event) ⇒ Object


61
62
63
64
65
66
# File 'activejob/lib/active_job/logging.rb', line 61

def enqueue_at(event)
  info do
    job = event.payload[:job]
    "Enqueued #{job.class.name} (Job ID: #{job.job_id}) to #{queue_name(event)} at #{scheduled_at(event)}" + args_info(job)
  end
end

#perform(event) ⇒ Object


75
76
77
78
79
80
# File 'activejob/lib/active_job/logging.rb', line 75

def perform(event)
  info do
    job = event.payload[:job]
    "Performed #{job.class.name} from #{queue_name(event)} in #{event.duration.round(2)}ms"
  end
end

#perform_start(event) ⇒ Object


68
69
70
71
72
73
# File 'activejob/lib/active_job/logging.rb', line 68

def perform_start(event)
  info do
    job = event.payload[:job]
    "Performing #{job.class.name} from #{queue_name(event)}" + args_info(job)
  end
end