Sha256: b9b7306301172504297ab2d21ebb53640df270e54b474b094b25e1584879499e

Contents?: true

Size: 523 Bytes

Versions: 1

Compression:

Stored size: 523 Bytes

Contents

module LazyResource
  class LogSubscriber < ActiveSupport::LogSubscriber
    def request(event)
      info "\s\s\s\s[#{event.payload[:code]}](#{((event.payload[:time] || 0) * 1000).ceil}ms) #{event.payload[:url]}"
    end

    def request_group_started(event)
      info "Processing requests:"
    end

    def request_group_finished(event)
      info "Requests finished in #{((event.payload[:end_time] - event.payload[:start_time]) * 1000).ceil}ms"
    end
  end
end

LazyResource::LogSubscriber.attach_to(:lazy_resource)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lazy_resource-0.5.0 lib/lazy_resource/log_subscriber.rb