mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
19e7f65dd1
Logging Action Cable to STDOUT caused the development log to see double messages like this: ``` Started GET "/" for ::1 at 2015-12-17 15:21:34 -0500 Started GET "/" for ::1 at 2015-12-17 15:21:34 -0500 Processing by Rails::WelcomeController#index as HTML Processing by Rails::WelcomeController#index as HTML Rendered /welcome/index.html.erb (0.0ms) Rendered /welcome/index.html.erb (0.0ms) Completed 200 OK in 3ms (Views: 1.3ms | ActiveRecord: 0.0ms) Completed 200 OK in 3ms (Views: 1.3ms | ActiveRecord: 0.0ms) ``` Now that Action Cable is part of Rails it doesn't need it's own logger and will log to STDOUT via the local dev server here: https://github.com/rails/rails/blob/master/railties/lib/rails/commands/server.rb
35 lines
1 KiB
Ruby
35 lines
1 KiB
Ruby
module ActionCable
|
|
module Server
|
|
# An instance of this configuration object is available via ActionCable.server.config, which allows you to tweak the configuration points
|
|
# in a Rails config initializer.
|
|
class Configuration
|
|
attr_accessor :logger, :log_tags
|
|
attr_accessor :connection_class, :worker_pool_size
|
|
attr_accessor :redis, :channels_path
|
|
attr_accessor :disable_request_forgery_protection, :allowed_request_origins
|
|
attr_accessor :url
|
|
|
|
def initialize
|
|
@log_tags = []
|
|
|
|
@connection_class = ApplicationCable::Connection
|
|
@worker_pool_size = 100
|
|
|
|
@channels_path = Rails.root.join('app/channels')
|
|
|
|
@disable_request_forgery_protection = false
|
|
end
|
|
|
|
def channel_paths
|
|
@channels ||= Dir["#{channels_path}/**/*_channel.rb"]
|
|
end
|
|
|
|
def channel_class_names
|
|
@channel_class_names ||= channel_paths.collect do |channel_path|
|
|
Pathname.new(channel_path).basename.to_s.split('.').first.camelize
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|