Class: Logger
Defined Under Namespace
Classes: Benchmarker
Instance Method Summary collapse
Instance Method Details
#benchmark(msg = "Benchmark", opts = {}, &block) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/core-extensions/benchmark-logger.rb', line 22 def benchmark(msg = "Benchmark", opts = {}, &block) benchmarker = Benchmarker.new(msg, opts[:severity] || :warn) yield(benchmarker).tap do self.send(benchmarker.severity, benchmarker.to_s) if benchmarker.runtime > (opts[:minimum] || -1) end rescue warn "FAIL #{benchmarker}" raise end |