Class: ApiParticulier::Commons::Middleware::Logging
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- ApiParticulier::Commons::Middleware::Logging
- Defined in:
- lib/api_particulier/commons/middleware/logging.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, logger: nil, redact_query: false) ⇒ Logging
constructor
A new instance of Logging.
Constructor Details
#initialize(app, logger: nil, redact_query: false) ⇒ Logging
Returns a new instance of Logging.
10 11 12 13 14 |
# File 'lib/api_particulier/commons/middleware/logging.rb', line 10 def initialize(app, logger: nil, redact_query: false) super(app) @logger = logger @redact_query = redact_query end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/api_particulier/commons/middleware/logging.rb', line 16 def call(env) started = monotonic_now response = @app.call(env) log(env, response, monotonic_now - started) if @logger response rescue StandardError => e log_error(env, e, monotonic_now - started) if @logger raise end |