Class: QueryTracer::Logger
- Inherits:
-
ActiveSupport::LogSubscriber
- Object
- ActiveSupport::LogSubscriber
- QueryTracer::Logger
- Defined in:
- lib/query_tracer/logger.rb
Instance Method Summary collapse
-
#sql(event) ⇒ Object
event.payload event.duration event.payload.
Instance Method Details
#sql(event) ⇒ Object
event.payload event.duration event.payload
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/query_tracer/logger.rb', line 10 def sql(event) return unless QueryTracer.config.enabled sql = event.payload[:sql] # Skip noisy queries trace = Tracer.build_trace(sql) unless trace.blank? = color("^^^^ Called from: ", YELLOW, true) indent = color("-> ", YELLOW, true) send QueryTracer.config.log_level, + trace.join("\n#{indent}") end end |