Sha256: 8c0607c98995b8f6103f9289429a94e6843583a33a45def91d74d4836679feae

Contents?: true

Size: 442 Bytes

Versions: 1

Compression:

Stored size: 442 Bytes

Contents

module OldApiResource
  class LogSubscriber < ActiveSupport::LogSubscriber
    def request(event)
      result = event[:payload]
      info "#{event.payload[:method].to_s.upcase} #{even.payload[:request_uri]}"
      info "--> %d %s %d (%.1fms)" % [result.code, result.message, result.body.to_s.length, event.duration]
    end
    
    def logger
      Rails.logger
    end
  end
end

OldApiResource::LogSubscriber.attach_to :old_api_resource

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
old_api_resource-0.3.0 lib/old_api_resource/log_subscriber.rb