Class: Twirl::Instrumentation::LogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/twirl/instrumentation/log_subscriber.rb

Instance Method Summary collapse

Instance Method Details

#op(event) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/twirl/instrumentation/log_subscriber.rb', line 8

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