Sha256: 24ea7b101833591aab56211db279bb6835381a99e683557fd631cd1f1f04c1f0

Contents?: true

Size: 581 Bytes

Versions: 36

Compression:

Stored size: 581 Bytes

Contents

# frozen_string_literal: true

module AnyCable
  module Rails
    module Middlewares
      # Middleware to add `sid` (session ID) tag to logs.
      #
      # Session ID could be provided through gRPC metadata `sid` key.
      #
      # See https://github.com/grpc/grpc-go/blob/master/Documentation/grpc-metadata.md
      class LogTagging < AnyCable::Middleware
        def call(_method, _request, metadata)
          sid = metadata["sid"]
          return yield unless sid

          AnyCable.logger.tagged("AnyCable sid=#{sid}") { yield }
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
anycable-rails-core-1.5.6 lib/anycable/rails/middlewares/log_tagging.rb
anycable-rails-core-1.6.0.rc.1 lib/anycable/rails/middlewares/log_tagging.rb
anycable-rails-core-1.5.5 lib/anycable/rails/middlewares/log_tagging.rb
anycable-rails-core-1.5.4 lib/anycable/rails/middlewares/log_tagging.rb
anycable-rails-core-1.5.3 lib/anycable/rails/middlewares/log_tagging.rb
anycable-rails-core-1.5.2 lib/anycable/rails/middlewares/log_tagging.rb
anycable-rails-core-1.5.1 lib/anycable/rails/middlewares/log_tagging.rb
anycable-rails-core-1.5.0 lib/anycable/rails/middlewares/log_tagging.rb
anycable-rails-core-1.5.0.rc.1 lib/anycable/rails/middlewares/log_tagging.rb
anycable-rails-core-1.4.4 lib/anycable/rails/middlewares/log_tagging.rb
anycable-rails-core-1.4.3 lib/anycable/rails/middlewares/log_tagging.rb
anycable-rails-core-1.4.2 lib/anycable/rails/middlewares/log_tagging.rb
anycable-rails-core-1.4.1 lib/anycable/rails/middlewares/log_tagging.rb
anycable-rails-core-1.4.0 lib/anycable/rails/middlewares/log_tagging.rb
anycable-rails-1.4.0 lib/anycable/rails/middlewares/log_tagging.rb
anycable-rails-1.4.0.rc.4 lib/anycable/rails/middlewares/log_tagging.rb
anycable-rails-1.4.0.rc.3 lib/anycable/rails/middlewares/log_tagging.rb
anycable-rails-1.4.0.rc.2 lib/anycable/rails/middlewares/log_tagging.rb
anycable-rails-1.4.0.rc.1 lib/anycable/rails/middlewares/log_tagging.rb
anycable-rails-1.3.7 lib/anycable/rails/middlewares/log_tagging.rb