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

4 weeks ago
  1. module Semantic
  2. module Subscribers
  3. # LogSubscriber for event_group :active_record
  4. class ActiveRecord < LogSubscriber
  5. include AnsiColors
  6. def sql(event)
  7. name = event.payload[:name]
  8. return if name == 'SCHEMA'
  9. sql = event.payload[:sql]
  10. cached = event.payload[:cached]
  11. row_count = event.payload[:row_count]
  12. logger.debug("#{name}: #{sql} cached=#{cached} count=#{row_count}")
  13. end
  14. def instantiation(event)
  15. class_name = event.payload[:class_name]
  16. record_count = event.payload[:record_count]
  17. logger.debug("instantiate #{class_name} #{record_count} times")
  18. end
  19. def strict_loading_violation(event) = any_hook event
  20. def start_transaction(event) = any_hook event
  21. def transaction(event) = any_hook event
  22. end
  23. end
  24. end