Sha256: 0b219a7469183a7aa38b6a386b9851a3c2c4cd29d8370fcb3a4784082192b5f7
Contents?: true
Size: 817 Bytes
Versions: 13
Compression:
Stored size: 817 Bytes
Contents
require 'sequel/database/logging' require 'active_support/notifications' module Sequel class Database def log_connection_yield(sql, conn, args=nil) sql_for_log = "#{connection_info(conn) if conn && log_connection_info}#{sql}#{"; #{args.inspect}" if args}" start = Time.now begin ::ActiveSupport::Notifications.instrument( 'sql.sequel', :sql => sql, :name => self.class, :binds => args ) do yield end rescue => e log_exception(e, sql_for_log) unless @loggers.empty? raise ensure log_duration(Time.now - start, sql_for_log) unless e || @loggers.empty? end end def log_yield(sql, args = nil, &block) log_connection_yield(sql, nil, args, &block) end end end
Version data entries
13 entries across 13 versions & 1 rubygems