Sha256: a4452bd9a6d0ed959859ea4531ed9c62966b1dc706a6614d64fcad30188d81d9

Contents?: true

Size: 587 Bytes

Versions: 7

Compression:

Stored size: 587 Bytes

Contents

class RESTHome
  def request_with_instrumentation(method, path, options)
    ActiveSupport::Notifications.instrument("request.resthome", :client => self.class.name, method: method, path: path) do
      request_without_instrumentation(method, path, options)
    end
  end

  alias_method_chain :request, :instrumentation

  class LogSubscriber < ActiveSupport::LogSubscriber
    def request(event)
      info '%s (%.1fms) %s %s' % [event.payload[:client], event.duration, event.payload[:method].upcase, event.payload[:path]]
    end
  end
end

RESTHome::LogSubscriber.attach_to :resthome

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sessionm-resthome-0.8.11 lib/active_support/instrumentation.rb
sessionm-resthome-0.8.10 lib/active_support/instrumentation.rb
sessionm-resthome-0.8.9 lib/active_support/instrumentation.rb
sessionm-resthome-0.8.8 lib/active_support/instrumentation.rb
sessionm-resthome-0.8.7 lib/active_support/instrumentation.rb
sessionm-resthome-0.8.6 lib/active_support/instrumentation.rb
sessionm-resthome-0.8.5 lib/active_support/instrumentation.rb