Class: Lograge::ActiveRecordLogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/lograge/active_record_log_subscriber.rb

Overview

Log subscriber to replace ActiveRecord’s default one

Instance Method Summary collapse

Instance Method Details

#sql(event) ⇒ Object

Every time there’s an SQL query, stores it into the Thread. They’ll later be accessed from the RequestLogSubscriber.



8
9
10
11
12
13
14
# File 'lib/lograge/active_record_log_subscriber.rb', line 8

def sql(event)
  increase_runtime_duration(event)
  return unless valid?(event)

  filter_query(event)
  store(event)
end