module Sequel::CallerLogging
Constants
- SEQUEL_LIB_PATH
Attributes
caller_logging_formatter[RW]
A callable to format the external caller
caller_logging_ignore[RW]
A regexp of caller lines to ignore, in addition to internal Sequel
and Ruby code.
Public Instance Methods
log_connection_yield(sql, conn, args=nil)
click to toggle source
Include caller information when logging query.
Calls superclass method
# File lib/sequel/extensions/caller_logging.rb 47 def log_connection_yield(sql, conn, args=nil) 48 if !@loggers.empty? && (external_caller = external_caller_for_log) 49 sql = "#{external_caller} #{sql}" 50 end 51 super 52 end
Private Instance Methods
external_caller_for_log()
click to toggle source
The caller to log, ignoring internal Sequel
and Ruby code, and user specified lines to ignore.
# File lib/sequel/extensions/caller_logging.rb 58 def external_caller_for_log 59 ignore = caller_logging_ignore 60 c = caller.find do |line| 61 !(line.start_with?(SEQUEL_LIB_PATH) || 62 line.start_with?(RbConfig::CONFIG["rubylibdir"]) || 63 (ignore && line =~ ignore)) 64 end 65 66 if c 67 c = if formatter = caller_logging_formatter 68 formatter.call(c) 69 else 70 "(source: #{c})" 71 end 72 end 73 74 c 75 end