diff options
author | Alex Peattie <alexpeattie@gmail.com> | 2015-10-06 19:59:27 +0100 |
---|---|---|
committer | Alex Peattie <alexpeattie@gmail.com> | 2015-10-06 19:59:27 +0100 |
commit | fdbf759ac56eea40765bd2d45eaf9453011b5bd3 (patch) | |
tree | efe4c8a45f092a893eb7feadbb34f8cc2e0f6551 | |
parent | 91d6db34357634eaa0903b5c05a5db8b10066366 (diff) | |
download | rails-fdbf759ac56eea40765bd2d45eaf9453011b5bd3.tar.gz rails-fdbf759ac56eea40765bd2d45eaf9453011b5bd3.tar.bz2 rails-fdbf759ac56eea40765bd2d45eaf9453011b5bd3.zip |
Fix NoMethodError when using a custom Rails.logger class
-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 08a75156a3..84393845c4 100644 --- a/lib/action_cable/connection/base.rb +++ b/lib/action_cable/connection/base.rb @@ -56,7 +56,7 @@ module ActionCable def initialize(server, env) @server, @env = server, env - @logger = new_tagged_logger + @logger = new_tagged_logger || server.logger @websocket = ActionCable::Connection::WebSocket.new(env) @heartbeat = ActionCable::Connection::Heartbeat.new(self) @@ -177,8 +177,10 @@ module ActionCable # Tags are declared in the server but computed in the connection. This allows us per-connection tailored tags. def new_tagged_logger - TaggedLoggerProxy.new server.logger, - tags: server.config.log_tags.map { |tag| tag.respond_to?(:call) ? tag.call(request) : tag.to_s.camelize } + if server.logger.respond_to?(:tagged) + TaggedLoggerProxy.new server.logger, + tags: server.config.log_tags.map { |tag| tag.respond_to?(:call) ? tag.call(request) : tag.to_s.camelize } + end end def started_request_message |