From 995c101caae06ec38d0106dcd9ee36954a489687 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 20 Jun 2015 16:51:11 +0200 Subject: More logging improvements --- lib/action_cable/broadcaster.rb | 2 +- lib/action_cable/channel/base.rb | 2 +- lib/action_cable/channel/redis.rb | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/action_cable/broadcaster.rb b/lib/action_cable/broadcaster.rb index 38c56b8262..7d8cc90970 100644 --- a/lib/action_cable/broadcaster.rb +++ b/lib/action_cable/broadcaster.rb @@ -10,8 +10,8 @@ module ActionCable end def broadcast(message) + logger.info "[ActionCable] Broadcasting to #{channel}: #{message}" redis.publish channel, message.to_json - logger.info "[ActionCable] Broadcasting to channel (#{channel}): #{message}" end end end diff --git a/lib/action_cable/channel/base.rb b/lib/action_cable/channel/base.rb index 4c90849a06..e6ca45ddcc 100644 --- a/lib/action_cable/channel/base.rb +++ b/lib/action_cable/channel/base.rb @@ -81,7 +81,7 @@ module ActionCable def transmit(data, via: nil) if authorized? - logger.info "#{channel_name} transmitting #{data.inspect} #{via}" + logger.info "#{channel_name} transmitting #{data.inspect}".tap { |m| m << " (via #{via})" if via } connection.transmit({ identifier: @channel_identifier, message: data }.to_json) else unauthorized diff --git a/lib/action_cable/channel/redis.rb b/lib/action_cable/channel/redis.rb index bdd6ab9dcf..0f77dc0418 100644 --- a/lib/action_cable/channel/redis.rb +++ b/lib/action_cable/channel/redis.rb @@ -14,14 +14,14 @@ module ActionCable @_redis_channels << [ redis_channel, callback ] pubsub.subscribe(redis_channel, &callback) - logger.info "#{channel_name} subscribed to incoming actions from #{redis_channel}" + logger.info "#{channel_name} subscribed to broadcasts from #{redis_channel}" end def unsubscribe_from_all_channels if @_redis_channels @_redis_channels.each do |redis_channel, callback| pubsub.unsubscribe_proc(redis_channel, callback) - logger.info "#{channel_name} unsubscribed from incoming actions #{redis_channel}" + logger.info "#{channel_name} unsubscribed to broadcasts from #{redis_channel}" end end end @@ -29,7 +29,7 @@ module ActionCable protected def default_subscription_callback(channel) -> (message) do - transmit ActiveSupport::JSON.decode(message), via: "incoming action from #{channel}" + transmit ActiveSupport::JSON.decode(message), via: "broadcast from #{channel}" end end end -- cgit v1.2.3