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:
parent
c2fbcba16d
commit
4d24854342
1 changed files with 5 additions and 9 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue