Sha256: c635441b80c78835f6cb16fdc400e6e073e9f3942c54ac436775399a955cc8da

Contents?: true

Size: 733 Bytes

Versions: 10

Compression:

Stored size: 733 Bytes

Contents

module LogSanity
  module LogSubscriber
    class ActionCable < Base

      def process(event)
        payload = event.payload
        log 'event', 'ws_connect'
        log 'status', payload[:status]
        # logged by the actiondispatch subscriber
      end

      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

    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
log_sanity-2.3.0 lib/log_sanity/log_subscribers/action_cable.rb
log_sanity-2.2.0 lib/log_sanity/log_subscribers/action_cable.rb
log_sanity-2.1.2 lib/log_sanity/log_subscribers/action_cable.rb
log_sanity-2.1.1 lib/log_sanity/log_subscribers/action_cable.rb
log_sanity-2.1.0 lib/log_sanity/log_subscribers/action_cable.rb
log_sanity-2.0.0 lib/log_sanity/log_subscribers/action_cable.rb
log_sanity-1.3.2 lib/log_sanity/log_subscribers/action_cable.rb
log_sanity-1.3.1 lib/log_sanity/log_subscribers/action_cable.rb
log_sanity-1.3.0 lib/log_sanity/log_subscribers/action_cable.rb
log_sanity-1.2.0 lib/log_sanity/log_subscribers/action_cable.rb