Sha256: c9c7770c9ad0fb4a16f10fd1afa6b64dfdf3a929904272f409f551e3015539fd
Contents?: true
Size: 816 Bytes
Versions: 2
Compression:
Stored size: 816 Bytes
Contents
require 'securerandom' require 'active_support/notifications' require 'active_support/log_subscriber' module Twirl module Instrumentation class LogSubscriber < ::ActiveSupport::LogSubscriber def op(event) return unless logger.debug? op = event.payload[:op] bytes = event.payload[:bytes] queue_name = event.payload[:queue_name] return unless op description = "Twirl op(#{op})" details = "" if queue_name details += "queue_name=#{queue_name} " end if bytes details += "bytes=#{bytes} " end name = '%s (%.1fms)' % [description, event.duration] debug " #{color(name, CYAN, true)} [ #{details} ]" end end end Instrumentation::LogSubscriber.attach_to :twirl end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
twirl-0.2.0 | lib/twirl/instrumentation/log_subscriber.rb |
twirl-0.1.0 | lib/twirl/instrumentation/log_subscriber.rb |