Class: PumaStatsLogger::Middleware

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

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ Middleware

Returns a new instance of Middleware.



3
4
5
6
# File 'lib/puma_stats_logger/middleware.rb', line 3

def initialize(app, options = {})
  @app = app
  @logger = options[:logger] || Logger.new($stdout)
end

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
# File 'lib/puma_stats_logger/middleware.rb', line 8

def call(env)
  status, headers, body = @app.call(env)
  log_puma_stats if puma_options
  [status, headers, body]
end