class Searchkick::LogSubscriber

Public Class Methods

reset_runtime() click to toggle source
# File lib/searchkick/log_subscriber.rb, line 12
def self.reset_runtime
  rt = runtime
  self.runtime = 0
  rt
end
runtime() click to toggle source
# File lib/searchkick/log_subscriber.rb, line 8
def self.runtime
  Thread.current[:searchkick_runtime] ||= 0
end
runtime=(value) click to toggle source
# File lib/searchkick/log_subscriber.rb, line 4
def self.runtime=(value)
  Thread.current[:searchkick_runtime] = value
end

Public Instance Methods

request(event) click to toggle source
# File lib/searchkick/log_subscriber.rb, line 37
def request(event)
  self.class.runtime += event.duration
  return unless logger.debug?

  payload = event.payload
  name = "#{payload[:name]} (#{event.duration.round(1)}ms)"

  debug "  #{color(name, YELLOW, bold: true)}  #{payload.except(:name).to_json}"
end