Sha256: fe1dff46ba9084289beae82e1e88e7c4e517e1cf9f7aa8272ef699b00889e56b

Contents?: true

Size: 703 Bytes

Versions: 2

Compression:

Stored size: 703 Bytes

Contents

module Rails
  module Sequel
    module Logging
      def log_duration (duration, message)
        @controller_runtime ||= 0
        @controller_runtime += duration
        ActiveSupport::Notifications.instrument('sql.sequel', 
          :sql => message,
          :name => 'SQL',
          :duration => duration * 1000
        )
        super
      end

      def log_each (level, message)
        # Rails logging is handled by the log subscriber
        less_rails = @loggers - [Rails.logger]
        less_rails.each { |logger| logger.send(level, message) }
      end

      def reset_runtime
        rt, @controller_runtime = @controller_runtime, 0
        rt.to_f * 1000
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails3_sequel-0.3.1 lib/rails3_sequel/logging.rb
rails3_sequel-0.2.2 lib/rails3_sequel/logging.rb