Module: Omnibus::Instrumentation

Includes:
Logging
Included in:
Builder, HealthCheck, Packager::Base
Defined in:
lib/omnibus/instrumentation.rb

Instance Method Summary collapse

Methods included from Logging

included

Instance Method Details

#measure(label, &block) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/omnibus/instrumentation.rb', line 21

def measure(label, &block)
  start = Time.now
  yield
ensure
  elapsed = Time.now - start
  log.info(log_key) { "#{label}: #{elapsed.to_f.round(4)}s" }
end