Sha256: 93b6aeab2012a1943430f0daf9d1287f1677860530a4d5bd97b41381754ce94f

Contents?: true

Size: 412 Bytes

Versions: 31

Compression:

Stored size: 412 Bytes

Contents

require "logger"
class ApiClient::Connection::Middlewares::Request::Logger < Faraday::Middleware

  def call(env)
    time    = Time.now
    returns = @app.call(env)
    taken   = Time.now - time
    @logger.info "#{env[:method].to_s.upcase} #{env[:url]}: #{"%.4f" % taken} seconds"
    returns
  end

  def initialize(app, logger = nil)
    @logger = logger || ::Logger.new(STDOUT)
    @app    = app
  end

end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
api_client-0.5.15 lib/api_client/connection/middlewares/request/logger.rb
api_client-0.5.14 lib/api_client/connection/middlewares/request/logger.rb
api_client-0.5.13 lib/api_client/connection/middlewares/request/logger.rb
api_client-0.5.12 lib/api_client/connection/middlewares/request/logger.rb
api_client-0.5.11 lib/api_client/connection/middlewares/request/logger.rb
api_client-0.5.9 lib/api_client/connection/middlewares/request/logger.rb
api_client-0.5.7 lib/api_client/connection/middlewares/request/logger.rb
api_client-0.5.6 lib/api_client/connection/middlewares/request/logger.rb
api_client-0.5.5 lib/api_client/connection/middlewares/request/logger.rb
api_client-0.5.4 lib/api_client/connection/middlewares/request/logger.rb
api_client-0.5.3 lib/api_client/connection/middlewares/request/logger.rb
api_client-0.5.2 lib/api_client/connection/middlewares/request/logger.rb
api_client-0.5.1 lib/api_client/connection/middlewares/request/logger.rb
api_client-0.5.0 lib/api_client/connection/middlewares/request/logger.rb
api_client-0.4.3 lib/api_client/connection/middlewares/request/logger.rb
api_client-0.4.2 lib/api_client/connection/middlewares/request/logger.rb
api_client-0.4.1 lib/api_client/connection/middlewares/request/logger.rb
api_client-0.3.3 lib/api_client/connection/middlewares/request/logger.rb
api_client-0.4.0 lib/api_client/connection/middlewares/request/logger.rb
api_client-0.3.2 lib/api_client/connection/middlewares/request/logger.rb