module Logtail::Timer
This is an ultra-simple abstraction for timing code. This provides a little more control around how Logtail
automatically processes “timers”.
@example
timer = Logtail::Timer.start # ... code to time logger.info("My log message", my_event: {time_ms: timer})
Public Class Methods
duration_ms(timer)
click to toggle source
Get the duration in milliseconds from the object returned in {#start}
# File lib/logtail/timer.rb, line 16 def self.duration_ms(timer) now = Time.now (now - timer) * 1000.0 end
start()
click to toggle source
Abstract for starting a logtail. Currently this is simply calling `Time.now`.
# File lib/logtail/timer.rb, line 11 def self.start Time.now end