Class: AnyCable::Rails::Middlewares::LogTagging
- Inherits:
-
Middleware
- Object
- Middleware
- AnyCable::Rails::Middlewares::LogTagging
- Defined in:
- lib/anycable/rails/middlewares/log_tagging.rb
Overview
Middleware to add ‘sid` (session ID) tag to logs.
Session ID could be provided through gRPC metadata ‘sid` key.
See github.com/grpc/grpc-go/blob/master/Documentation/grpc-metadata.md
Instance Method Summary collapse
Instance Method Details
#call(_request, call, _method) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/anycable/rails/middlewares/log_tagging.rb', line 12 def call(_request, call, _method) sid = call.["sid"] return yield unless sid AnyCable.logger.tagged("AnyCable sid=#{sid}") { yield } end |