class Searchkick::LogSubscriber

github.com/rails/rails/blob/master/activerecord/lib/active_record/log_subscriber.rb

Public Class Methods

reset_runtime() click to toggle source
# File lib/searchkick/logging.rb, line 64
def self.reset_runtime
  rt, self.runtime = runtime, 0
  rt
end
runtime() click to toggle source
# File lib/searchkick/logging.rb, line 60
def self.runtime
  Thread.current[:searchkick_runtime] ||= 0
end
runtime=(value) click to toggle source
# File lib/searchkick/logging.rb, line 56
def self.runtime=(value)
  Thread.current[:searchkick_runtime] = value
end

Public Instance Methods

request(event) click to toggle source
# File lib/searchkick/logging.rb, line 83
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, true)}  #{payload.except(:name).to_json}"
end