From 3fe383c6015cdbe9874340d8d8bc1a5954d08234 Mon Sep 17 00:00:00 2001 From: Jankees van Woezik Date: Tue, 16 Feb 2016 14:45:26 +0100 Subject: Truncate ActionCable broadcast message to 300 chars When running the ActionCable server in development I get a lot of output in my logs, this commit sets a maximum length of 300 characters for a broadcast log message. --- actioncable/lib/action_cable/channel/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actioncable/lib') diff --git a/actioncable/lib/action_cable/channel/base.rb b/actioncable/lib/action_cable/channel/base.rb index 874ebe2e71..86c8f12f6e 100644 --- a/actioncable/lib/action_cable/channel/base.rb +++ b/actioncable/lib/action_cable/channel/base.rb @@ -191,7 +191,7 @@ module ActionCable # Transmit a hash of data to the subscriber. The hash will automatically be wrapped in a JSON envelope with # the proper channel identifier marked as the recipient. def transmit(data, via: nil) - logger.info "#{self.class.name} transmitting #{data.inspect}".tap { |m| m << " (via #{via})" if via } + logger.info "#{self.class.name} transmitting #{data.inspect.truncate(300)}".tap { |m| m << " (via #{via})" if via } connection.transmit ActiveSupport::JSON.encode(identifier: @identifier, message: data) end -- cgit v1.2.3