Class: LogSanity::LogSubscriber::ActionCable
- Inherits:
-
Base
- Object
- ActiveSupport::LogSubscriber
- Base
- LogSanity::LogSubscriber::ActionCable
- Defined in:
- lib/log_sanity/log_subscribers/action_cable.rb
Instance Method Summary collapse
Instance Method Details
#on_close(event) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/log_sanity/log_subscribers/action_cable.rb', line 12 def on_close(event) payload = event.payload request = payload[:request] info do e = { 'at' => Time.now, 'event' => 'ws_disconnect', 'ip' => request.remote_ip, 'rq' => request.uuid, 'duration' => {'socket' => "#{payload[:connection_sec].round}s"} } e['reason'] = payload[:reason] if payload[:reason] e end end |
#process(event) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/log_sanity/log_subscribers/action_cable.rb', line 5 def process(event) payload = event.payload log 'event', 'ws_connect' log 'status', payload[:status] # logged by the actiondispatch subscriber end |