Sha256: 337cd81f03c0c53985ba18b9914eedb412e253772bfef50139363add8930f446
Contents?: true
Size: 623 Bytes
Versions: 22
Compression:
Stored size: 623 Bytes
Contents
module Logtail # 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}) module Timer # Abstract for starting a logtail. Currently this is simply calling `Time.now`. def self.start Time.now end # Get the duration in milliseconds from the object returned in {#start} def self.duration_ms(timer) now = Time.now (now - timer) * 1000.0 end end end
Version data entries
22 entries across 22 versions & 2 rubygems