Class: PactBroker::Test::HttpTestDataBuilder::LogRequestLength
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- PactBroker::Test::HttpTestDataBuilder::LogRequestLength
- Defined in:
- lib/pact_broker/test/http_test_data_builder.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, logger) ⇒ LogRequestLength
constructor
A new instance of LogRequestLength.
Constructor Details
#initialize(app, logger) ⇒ LogRequestLength
Returns a new instance of LogRequestLength.
27 28 29 30 31 |
# File 'lib/pact_broker/test/http_test_data_builder.rb', line 27 def initialize(app, logger) super(app) @app = app @logger = logger end |
Instance Method Details
#call(env) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/pact_broker/test/http_test_data_builder.rb', line 33 def call(env) starting = Process.clock_gettime(Process::CLOCK_MONOTONIC) response = @app.call(env) ending = Process.clock_gettime(Process::CLOCK_MONOTONIC) elapsed = ending - starting @logger.info "Response time: #{elapsed}" response end |