diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2015-10-23 20:08:52 -0200 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2015-10-23 20:08:52 -0200 |
commit | 1db8c56cefe2e74d01ad5f3d4d4da1329013e2d6 (patch) | |
tree | d8e7ba18ede3bfb78ba15eeb2d6c76242fa05ff2 /lib/action_cable/connection/base.rb | |
parent | 81cc3cd85660321950c1f196b15682ee1053ee38 (diff) | |
parent | fdbf759ac56eea40765bd2d45eaf9453011b5bd3 (diff) | |
download | rails-1db8c56cefe2e74d01ad5f3d4d4da1329013e2d6.tar.gz rails-1db8c56cefe2e74d01ad5f3d4d4da1329013e2d6.tar.bz2 rails-1db8c56cefe2e74d01ad5f3d4d4da1329013e2d6.zip |
Merge pull request #84 from alexpeattie/nonstandard-logger-fix
Fix NoMethodError when using a custom Rails.logger class
Diffstat (limited to 'lib/action_cable/connection/base.rb')
-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 9f74226f98..a629f29643 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) @subscriptions = ActionCable::Connection::Subscriptions.new(self) @@ -193,8 +193,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 |