instance method
log
Ruby on Rails 2.3.18
Since v2.2.3Signature
log(sql, name)
No documentation comment.
Parameters
-
sqlreq -
namereq
Source
# File activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 203
def log(sql, name)
if block_given?
result = nil
ms = Benchmark.ms { result = yield }
@runtime += ms
log_info(sql, name, ms)
result
else
log_info(sql, name, 0)
nil
end
rescue SystemExit, SignalException, NoMemoryError => e
# Don't re-wrap these exceptions. They are probably not being caused by invalid
# sql, but rather some external stimulus beyond the responsibilty of this code.
# Additionaly, wrapping these exceptions with StatementInvalid would lead to
# meaningful loss of data, such as losing SystemExit#status.
raise e
rescue Exception => e
# Log message and raise exception.
# Set last_verification to 0, so that connection gets verified
# upon reentering the request loop
@last_verification = 0
message = "#{e.class.name}: #{e.message}: #{sql}"
log_info(message, name, 0)
raise ActiveRecord::StatementInvalid, message
end
Defined in activerecord/lib/active_record/connection_adapters/abstract_adapter.rb line 203
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::AbstractAdapter