Sha256: 7aca11b57eb27a5f2094208882af6508d35bff878f47ed0aff7513e2f8c4f8e6
Contents?: true
Size: 719 Bytes
Versions: 66
Compression:
Stored size: 719 Bytes
Contents
class Zendesk2::Logger < Faraday::Response::Middleware extend Forwardable def initialize(app, logger = nil) super(app) @logger = logger || ::Logger.new(STDOUT) end def_delegators :@logger, :debug, :info, :warn, :error, :fatal def call(env) info("#{env[:method]} => #{env[:url].to_s}") debug('request') { dump_headers env[:request_headers] } debug('request.body') { env[:body] } super end def on_complete(env) info("#{env[:status]} <= #{env[:url].to_s}") debug('response') { dump_headers env[:response_headers] } debug('response.body') { env[:body] } end private def dump_headers(headers) headers.map { |k, v| "#{k}: #{v.inspect}" }.join("\n") end end
Version data entries
66 entries across 66 versions & 1 rubygems