aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_cable
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2015-06-27 16:18:26 +0200
committerDavid Heinemeier Hansson <david@loudthinking.com>2015-06-27 16:18:26 +0200
commita2d55dfdc3878521793a8472c00b7a648ff21ae3 (patch)
tree9f5295fdcec5cfcde02b45306c065a1ed65abb11 /lib/action_cable
parent4cef27aacffb2ce5aada0c7199e9eb8787291baf (diff)
downloadrails-a2d55dfdc3878521793a8472c00b7a648ff21ae3.tar.gz
rails-a2d55dfdc3878521793a8472c00b7a648ff21ae3.tar.bz2
rails-a2d55dfdc3878521793a8472c00b7a648ff21ae3.zip
Use an encapsulated factory method
Diffstat (limited to 'lib/action_cable')
-rw-r--r--lib/action_cable/connection/base.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/action_cable/connection/base.rb b/lib/action_cable/connection/base.rb
index 4af651a5d9..a231288b4b 100644
--- a/lib/action_cable/connection/base.rb
+++ b/lib/action_cable/connection/base.rb
@@ -14,7 +14,7 @@ module ActionCable
@server, @env = server, env
- @logger = TaggedLoggerProxy.new(server.logger, tags: log_tags)
+ @logger = initialize_tagged_logger
@heartbeat = ActionCable::Connection::Heartbeat.new(self)
@subscriptions = ActionCable::Connection::Subscriptions.new(self)
@@ -143,8 +143,10 @@ module ActionCable
end
- def log_tags
- server.log_tags.map { |tag| tag.respond_to?(:call) ? tag.call(request) : tag.to_s.camelize }
+ # Tags are declared in the server but computed in the connection. This allows us per-connection tailored tags.
+ def initialize_tagged_logger
+ TaggedLoggerProxy.new server.logger,
+ tags: server.log_tags.map { |tag| tag.respond_to?(:call) ? tag.call(request) : tag.to_s.camelize }
end
end
end