Class: QueryTrail::LogSubscriber
- Inherits:
-
ActiveSupport::LogSubscriber
- Object
- ActiveSupport::LogSubscriber
- QueryTrail::LogSubscriber
- Defined in:
- lib/query_trail/log_subscriber.rb
Constant Summary collapse
- HEADER =
" \e[1m\e[34mQuery Trail:\e[0m "
- IGNORE_PAYLOAD_NAMES =
ActiveRecord::LogSubscriber::IGNORE_PAYLOAD_NAMES
Instance Method Summary collapse
Instance Method Details
#sql(event) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/query_trail/log_subscriber.rb', line 6 def sql(event) return unless logger.debug? payload = event.payload return if IGNORE_PAYLOAD_NAMES.include?(payload[:name]) if backtrace = backtrace_cleaner.clean(caller).presence logger.debug HEADER + backtrace.shift logger.debug backtrace.map { |line| ' ' * (HEADER.size - 13) + line }.join("\n") end end |