You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

28 lines
842 B

module Semantic
module Subscribers
# LogSubscriber for event_group :active_record
class ActiveRecord < LogSubscriber
include AnsiColors
def sql(event)
name = event.payload[:name]
return if name == 'SCHEMA'
sql = event.payload[:sql]
cached = event.payload[:cached]
row_count = event.payload[:row_count]
logger.debug("#{name}: #{sql} cached=#{cached} count=#{row_count}")
end
def instantiation(event)
class_name = event.payload[:class_name]
record_count = event.payload[:record_count]
logger.debug("instantiate #{class_name} #{record_count} times")
end
def strict_loading_violation(event) = any_hook event
def start_transaction(event) = any_hook event
def transaction(event) = any_hook event
end
end
end