Class: Logged::LogSubscriber::ActiveRecord
- Inherits:
-
Base
- Object
- ActiveSupport::LogSubscriber
- Base
- Logged::LogSubscriber::ActiveRecord
- Defined in:
- lib/logged/log_subscriber/active_record.rb
Overview
Log subscriber for ActiveRecord events
Constant Summary collapse
- IGNORE_PAYLOAD_NAMES =
This query types will be ignored
%w( SCHEMA EXPLAIN )
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#sql(event) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/logged/log_subscriber/active_record.rb', line 13 def sql(event) return if ignore?(event, :debug) payload = event.payload return if IGNORE_PAYLOAD_NAMES.include?(payload[:name]) data = { event: event.name, name: payload[:name].presence, sql: payload[:sql], duration: event.duration.to_f.round(2) } debug(event, data) end |