Class: JobIteration::LogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/job-iteration/log_subscriber.rb

Instance Method Summary collapse

Instance Method Details

#completed(event) ⇒ Object



29
30
31
32
33
34
# File 'lib/job-iteration/log_subscriber.rb', line 29

def completed(event)
  info do
    message = "[JobIteration::Iteration] Completed iterating. times_interrupted=%d total_time=%.3f"
    Kernel.format(message, event.payload[:times_interrupted], event.payload[:total_time])
  end
end

#interrupted(event) ⇒ Object



22
23
24
25
26
27
# File 'lib/job-iteration/log_subscriber.rb', line 22

def interrupted(event)
  info do
    "[JobIteration::Iteration] Interrupting and re-enqueueing the job " \
      "cursor_position=#{event.payload[:cursor_position]}"
  end
end

#loggerObject



5
6
7
# File 'lib/job-iteration/log_subscriber.rb', line 5

def logger
  JobIteration.logger
end

#nil_enumerator(event) ⇒ Object



9
10
11
12
13
# File 'lib/job-iteration/log_subscriber.rb', line 9

def nil_enumerator(event)
  info do
    "[JobIteration::Iteration] `build_enumerator` returned nil. Skipping the job."
  end
end

#not_found(event) ⇒ Object



15
16
17
18
19
20
# File 'lib/job-iteration/log_subscriber.rb', line 15

def not_found(event)
  info do
    "[JobIteration::Iteration] Enumerator found nothing to iterate! " \
      "times_interrupted=#{event.payload[:times_interrupted]} cursor_position=#{event.payload[:cursor_position]}"
  end
end