Class: AppLogger::RackMiddleware
- Inherits:
-
Object
- Object
- AppLogger::RackMiddleware
- Includes:
- AppLogger
- Defined in:
- lib/app_logger/rack_middleware.rb
Constant Summary collapse
- MASK =
'***'.freeze
- RACK_LOGGER =
'rack.logger'.freeze
- SINATRA_ERROR =
'sinatra.error'.freeze
- KLARNA_CORRELATION_ID =
'Klarna-Correlation-Id'.freeze
Constants included from AppLogger
DATE_PATTERN, LOG_PATH, VERSION
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ RackMiddleware
constructor
A new instance of RackMiddleware.
Methods included from AppLogger
Constructor Details
#initialize(app, options = {}) ⇒ RackMiddleware
Returns a new instance of RackMiddleware.
12 13 14 15 16 17 |
# File 'lib/app_logger/rack_middleware.rb', line 12 def initialize(app, = {}) @app = app @path_filter = [:path_filter] @masked_params = [:masked_params] @logger = create_logger end |
Instance Method Details
#call(env) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/app_logger/rack_middleware.rb', line 19 def call(env) began_at = Time.now env[RACK_LOGGER] = @logger status, headers, body = @app.call(env) body = Rack::BodyProxy.new(body) do log(env, status, headers, began_at) end [status, headers, body] end |