Class: Airfoil::Middleware::LogEvent
- Defined in:
- lib/airfoil/middleware/log_event.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, logger) ⇒ LogEvent
constructor
A new instance of LogEvent.
Constructor Details
#initialize(app, logger) ⇒ LogEvent
Returns a new instance of LogEvent.
11 12 13 14 |
# File 'lib/airfoil/middleware/log_event.rb', line 11 def initialize(app, logger) super(app) @logger = logger end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/airfoil/middleware/log_event.rb', line 16 def call(env) event = env[:event] logged_data = { "identity" => log_identity(event), "event" => log_event(event) }.to_json @logger.info(logged_data) result = @app.call(env) # Log the full result instead of the truncated version the middleware outputs @logger.info({result: result}.to_json) result end |