Sha256: 2c7e3dea62a16632c6f0a148d9824494f1283eec8a6dc1857cb02594a2646109
Contents?: true
Size: 919 Bytes
Versions: 3
Compression:
Stored size: 919 Bytes
Contents
module QueueKit module Instrumentable def instrumenter_from(options) @instrumenter = options[:instrumenter] if options.fetch(:debug) { false } enable_debug_mode end end def instrumenter @instrumenter ||= default_instrumenter end def instrument(name, payload = nil) options = default_instrument_options options.update(payload) if payload instrumenter.instrument("queuekit.#{name}", options) end def force_debug instrument(*yield) end def debug end def enable_debug_mode class << self alias debug force_debug end end def default_instrument_options {} end def default_instrumenter PutsInstrumenter.new end class PutsInstrumenter def instrument(name, payload = nil) puts "[#{Time.now}] #{name}: #{payload.inspect}" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
queue_kit-0.0.10 | lib/queue_kit/instrumentable.rb |
queue_kit-0.0.9 | lib/queue_kit/instrumentable.rb |
queue_kit-0.0.8 | lib/queue_kit/instrumentable.rb |