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
|
||||
def log(sql, name)
|
||||
if block_given?
|
||||
if @logger and @logger.debug?
|
||||
result = nil
|
||||
seconds = Benchmark.realtime { result = yield }
|
||||
@runtime += seconds
|
||||
log_info(sql, name, seconds)
|
||||
result
|
||||
else
|
||||
yield
|
||||
end
|
||||
result = nil
|
||||
seconds = Benchmark.realtime { result = yield }
|
||||
@runtime += seconds
|
||||
log_info(sql, name, seconds)
|
||||
result
|
||||
else
|
||||
log_info(sql, name, 0)
|
||||
nil
|
||||
|
|
Loading…
Reference in a new issue