Module: Moped::Instrumentable::Log
Overview
Provides logging instrumentation for compatibility with active support notifications.
Instance Method Summary collapse
-
#instrument(name, payload = {}) ⇒ Object
Instrument the log payload.
Instance Method Details
#instrument(name, payload = {}) ⇒ Object
Instrument the log payload.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/moped/instrumentable/log.rb', line 23 def instrument(name, payload = {}) started = Time.new begin yield if block_given? rescue Exception => e payload[:exception] = [ e.class.name, e. ] raise e ensure runtime = ("%.4fms" % (1000 * (Time.now.to_f - started.to_f))) Moped::Loggable.log_operations(payload[:prefix], payload[:ops], runtime) end end |