1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Ensure correct db time is reported in production logs.

This commit is contained in:
Pratik Naik 2008-05-28 22:58:45 +01:00
parent c2fbcba16d
commit 4d24854342

View file

@ -128,15 +128,11 @@ module ActiveRecord
protected protected
def log(sql, name) def log(sql, name)
if block_given? if block_given?
if @logger and @logger.debug? result = nil
result = nil seconds = Benchmark.realtime { result = yield }
seconds = Benchmark.realtime { result = yield } @runtime += seconds
@runtime += seconds log_info(sql, name, seconds)
log_info(sql, name, seconds) result
result
else
yield
end
else else
log_info(sql, name, 0) log_info(sql, name, 0)
nil nil