Sha256: 66934ba27e0def76eed2d877f8609ffa07339c3f1093478afcb40eda4a8d2997
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
# We require all of ActiveRecord because #logger usses ActiveRecord::Base. # We can't require active_record/base directly because ActiveRecord does not require # files properly. require "active_record" require "active_record/log_subscriber" module Timber module Integrations module ActiveRecord class LogSubscriber < Integrator # The log subscriber that replaces the default `ActiveRecord::LogSubscriber`. # The intent of this subscriber is to, as transparently as possible, properly # track events that are being logged here. This LogSubscriber will never change # default behavior / log messages. # # @private class TimberLogSubscriber < ::ActiveRecord::LogSubscriber def sql(event) r = super(event) if @message payload = event.payload event = Events::SQLQuery.new( sql: payload[:sql], time_ms: event.duration, message: @message ) logger.debug event @message = nil end r end private def debug(message) @message = message end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
timber-2.0.20 | lib/timber/integrations/active_record/log_subscriber/timber_log_subscriber.rb |
timber-2.0.19 | lib/timber/integrations/active_record/log_subscriber/timber_log_subscriber.rb |