Class: EcsLogging::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/ecs_logging/middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, logdev) ⇒ Middleware

Returns a new instance of Middleware.



25
26
27
28
# File 'lib/ecs_logging/middleware.rb', line 25

def initialize(app, logdev)
  @app = app
  @logger = Logger.new(logdev)
end

Instance Method Details

#call(env) ⇒ Object



30
31
32
33
34
# File 'lib/ecs_logging/middleware.rb', line 30

def call(env)
  status, headers, body = @app.call(env)
  body = BodyProxy.new(body) { log(env, status, headers) }
  [status, headers, body]
end