Skip to content

Instantly share code, notes, and snippets.

@thieso2
Created April 11, 2010 15:06
Show Gist options
  • Save thieso2/362801 to your computer and use it in GitHub Desktop.
Save thieso2/362801 to your computer and use it in GitHub Desktop.
class ActiveRecord::ConnectionAdapters::AbstractAdapter
def called_by(original_caller)
str = original_caller.reject { |info| !info.match /#{Rails.root}/ }.first
str.gsub(Rails.root,'')
end
def log_info(sql, name, ms)
if @logger && @logger.debug?
name = '%s (%.1fms) %s' % [name || 'SQL', ms, called_by(caller)]
@logger.debug(format_log_entry(name, sql.squeeze(' ')))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment