Module: Logtail::Timer
- Defined in:
- lib/logtail/timer.rb
Overview
This is an ultra-simple abstraction for timing code. This provides a little more control around how Logtail automatically processes “timers”.
Class Method Summary collapse
-
.duration_ms(timer) ⇒ Object
Get the duration in milliseconds from the object returned in #start.
-
.start ⇒ Object
Abstract for starting a logtail.
Class Method Details
.duration_ms(timer) ⇒ Object
Get the duration in milliseconds from the object returned in #start
16 17 18 19 |
# File 'lib/logtail/timer.rb', line 16 def self.duration_ms(timer) now = Time.now (now - timer) * 1000.0 end |
.start ⇒ Object
Abstract for starting a logtail. Currently this is simply calling ‘Time.now`.
11 12 13 |
# File 'lib/logtail/timer.rb', line 11 def self.start Time.now end |