Class: Locomotive::API::Middlewares::LoggerMiddleware

Inherits:
Object
  • Object
show all
Defined in:
app/api/locomotive/api/middlewares/logger_middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ LoggerMiddleware

Returns a new instance of LoggerMiddleware.



7
8
9
# File 'app/api/locomotive/api/middlewares/logger_middleware.rb', line 7

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
# File 'app/api/locomotive/api/middlewares/logger_middleware.rb', line 11

def call(env)
  @app.call(env).tap do |response|
    log_message(response, env)
  end
end