Class: PumaStatsLogger::Middleware
- Inherits:
-
Object
- Object
- PumaStatsLogger::Middleware
- Defined in:
- lib/puma_stats_logger/middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Middleware
constructor
A new instance of Middleware.
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, = {}) @app = app @logger = [: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 [status, headers, body] end |