Class: ActiveProfiling::ActiveRecord::BacktraceLogSubscriber
- Inherits:
-
ActiveSupport::LogSubscriber
- Object
- ActiveSupport::LogSubscriber
- ActiveProfiling::ActiveRecord::BacktraceLogSubscriber
- Defined in:
- lib/active-profiling/active_record/backtrace_log_subscriber.rb
Instance Method Summary collapse
Instance Method Details
#logger ⇒ Object
22 23 24 |
# File 'lib/active-profiling/active_record/backtrace_log_subscriber.rb', line 22 def logger ::ActiveRecord::Base.logger end |
#sql(event) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/active-profiling/active_record/backtrace_log_subscriber.rb', line 5 def sql(event) return unless skip_backtrace? payload = event.payload return if payload[:name] == 'SCHEMA' backtrace = event.send(:caller).collect { |line| " #{line}" if line_match(line) }.compact return if backtrace.empty? name = color(payload[:name], YELLOW, bold: true) logger.send(config.log_level, " #{name}\n#{backtrace.join("\n")}") end |