diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2015-06-27 16:18:26 +0200 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2015-06-27 16:18:26 +0200 |
commit | a2d55dfdc3878521793a8472c00b7a648ff21ae3 (patch) | |
tree | 9f5295fdcec5cfcde02b45306c065a1ed65abb11 | |
parent | 4cef27aacffb2ce5aada0c7199e9eb8787291baf (diff) | |
download | rails-a2d55dfdc3878521793a8472c00b7a648ff21ae3.tar.gz rails-a2d55dfdc3878521793a8472c00b7a648ff21ae3.tar.bz2 rails-a2d55dfdc3878521793a8472c00b7a648ff21ae3.zip |
Use an encapsulated factory method
-rw-r--r-- | lib/action_cable/connection/base.rb | 8 |
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 |