class Lograge::ActiveRecordLogSubscriber

Public Instance Methods

sql(event) click to toggle source
# File lib/lograge/sql/extension.rb, line 33
def sql(event)
  ActiveRecord::LogSubscriber.runtime += event.duration
  return if event.payload[:name] == 'SCHEMA'
  Thread.current[:lograge_sql_queries] ||= []
  Thread.current[:lograge_sql_queries] << ("#{event.payload[:name]} (#{event.duration.to_f.round(2)}) #{event.payload[:sql]}")
end