Class: Latta::Middleware
- Inherits:
-
Object
- Object
- Latta::Middleware
- Defined in:
- lib/latta/middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
10 11 12 |
# File 'lib/latta/middleware.rb', line 10 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/latta/middleware.rb', line 14 def call(env) log_output = StringIO.new original_logger = Rails.logger begin Rails.logger = Logger.new(log_output) status, headers, response = @app.call(env) [status, headers, response] rescue => exception console_output = log_output.string capture_exception(env, exception, console_output) raise exception ensure Rails.logger = original_logger end end |