module PhusionPassenger::ClassicRailsExtensions::AnalyticsLogging::ARAbstractAdapterExtension

Protected Instance Methods

log_with_passenger(sql, name, &block) click to toggle source
# File lib/phusion_passenger/classic_rails_extensions/analytics_logging/ar_abstract_adapter_extension.rb, line 33
def log_with_passenger(sql, name, &block)
        # Log SQL queries and durations.
        log = Thread.current[PASSENGER_ANALYTICS_WEB_LOG]
        if log
                if name
                        name = name.strip
                else
                        name = "SQL"
                end
                digest = Digest::MD5.hexdigest("#{name}\00##{sql}\00##{rand}")
                log.measure("DB BENCHMARK: #{digest}", "#{name}\n#{sql}") do
                        log_without_passenger(sql, name, &block)
                end
        else
                log_without_passenger(sql, name, &block)
        end
end