Sha256: c9094dba73b7ebad737fe07004a581b6f34421912754f905f0d06e5f41f2f904

Contents?: true

Size: 720 Bytes

Versions: 3

Compression:

Stored size: 720 Bytes

Contents

module Lograge
  module LogSubscribers
    class ActionCable < Base
      %i(perform_action subscribe unsubscribe connect disconnect).each do |method_name|
        define_method(method_name) do |event|
          process_main_event(event)
        end
      end

      private

      def initial_data(payload)
        {
          method: {},
          path: {},
          format: {},
          params: payload[:data],
          controller: payload[:channel_class] || payload[:connection_class],
          action: payload[:action]
        }
      end

      def default_status
        200
      end

      def extract_runtimes(event, _payload)
        { duration: event.duration.to_f.round(2) }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lograge-0.11.2 lib/lograge/log_subscribers/action_cable.rb
lograge-0.11.1 lib/lograge/log_subscribers/action_cable.rb
lograge-0.11.0 lib/lograge/log_subscribers/action_cable.rb