class Spyke::Instrumentation::LogSubscriber

Public Class Methods

reset_runtime() click to toggle source
# File lib/spyke/instrumentation/log_subscriber.rb, line 12
def self.reset_runtime
  rt, self.runtime = runtime, 0
  rt
end
runtime() click to toggle source
# File lib/spyke/instrumentation/log_subscriber.rb, line 8
def self.runtime
  Thread.current['spyke_request_runtime'] ||= 0
end
runtime=(value) click to toggle source
# File lib/spyke/instrumentation/log_subscriber.rb, line 4
def self.runtime=(value)
  Thread.current['spyke_request_runtime'] = value
end

Public Instance Methods

request(event) click to toggle source
# File lib/spyke/instrumentation/log_subscriber.rb, line 17
def request(event)
  return unless logger.debug?
  self.class.runtime += event.duration
  name = '%s (%.1fms)' % ["Spyke", event.duration]
  details = "#{event.payload[:method].upcase} #{event.payload[:url]} [#{event.payload[:status]}]"
  debug "  #{color(name, GREEN, true)}  #{color(details, BOLD, true)}"
end