Sha256: 74c35642f9470aeb1e1703b2ae1e5751cffae5fe39cb8a09e43da30e62b5af78

Contents?: true

Size: 734 Bytes

Versions: 30

Compression:

Stored size: 734 Bytes

Contents

module Timber
  module Probes
    # Reponsible for automatimcally tracking SQL query events in `ActiveRecord`, while still
    # preserving the default log style.
    class ActiveRecordLogSubscriber < Probe
      def initialize
        require "active_record/log_subscriber"
        require "timber/probes/active_record_log_subscriber/log_subscriber"
      rescue LoadError => e
        raise RequirementNotMetError.new(e.message)
      end

      def insert!
        return true if Util::ActiveSupportLogSubscriber.subscribed?(:active_record, LogSubscriber)
        Util::ActiveSupportLogSubscriber.unsubscribe(:active_record, ::ActiveRecord::LogSubscriber)
        LogSubscriber.attach_to(:active_record)
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
timber-1.1.14 lib/timber/probes/active_record_log_subscriber.rb
timber-1.1.13 lib/timber/probes/active_record_log_subscriber.rb
timber-1.1.12 lib/timber/probes/active_record_log_subscriber.rb
timber-1.1.11 lib/timber/probes/active_record_log_subscriber.rb
timber-1.1.10 lib/timber/probes/active_record_log_subscriber.rb
timber-1.1.9 lib/timber/probes/active_record_log_subscriber.rb
timber-1.1.8 lib/timber/probes/active_record_log_subscriber.rb
timber-1.1.7 lib/timber/probes/active_record_log_subscriber.rb
timber-1.1.6 lib/timber/probes/active_record_log_subscriber.rb
timber-1.1.5 lib/timber/probes/active_record_log_subscriber.rb
timber-1.1.4 lib/timber/probes/active_record_log_subscriber.rb
timber-1.1.3 lib/timber/probes/active_record_log_subscriber.rb
timber-1.1.2 lib/timber/probes/active_record_log_subscriber.rb
timber-1.1.1 lib/timber/probes/active_record_log_subscriber.rb
timber-1.1.0 lib/timber/probes/active_record_log_subscriber.rb
timber-1.0.13 lib/timber/probes/active_record_log_subscriber.rb
timber-1.0.12 lib/timber/probes/active_record_log_subscriber.rb
timber-1.0.11 lib/timber/probes/active_record_log_subscriber.rb
timber-1.0.10 lib/timber/probes/active_record_log_subscriber.rb
timber-1.0.9 lib/timber/probes/active_record_log_subscriber.rb