Class: Faraday::Conductivity::ExtendedLogging
- Inherits:
-
Middleware
- Object
- Middleware
- Faraday::Conductivity::ExtendedLogging
- Extended by:
- Forwardable
- Defined in:
- lib/faraday/conductivity/extended_logging.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ ExtendedLogging
constructor
A new instance of ExtendedLogging.
Constructor Details
#initialize(app, options = {}) ⇒ ExtendedLogging
Returns a new instance of ExtendedLogging.
10 11 12 13 14 15 16 |
# File 'lib/faraday/conductivity/extended_logging.rb', line 10 def initialize(app, = {}) @app = app @logger = .fetch(:logger) { require 'logger' ::Logger.new($stderr) } end |
Instance Method Details
#call(env) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/faraday/conductivity/extended_logging.rb', line 18 def call(env) start_time = Time.now info { request_info(env) } debug { request_debug(env) } @app.call(env).on_complete do end_time = Time.now response_time = end_time - start_time info { response_info(env, response_time) } debug { response_debug(env) } end end |