-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Hi, I am trying to use this gem in Rails 8!
I find this gem very useful, but when using it, I frequently see log messages related to Hotwire Spark.
To work around this, I created the following initializer.
However, I was wondering if there are any plans to support server-side log suppression in the gem’s configuration
(or if it can be done in the first place).
If such a setting already exists, please let me know.
Thanks for making a useful gem!
#config/initializers/hotwire_spark.rb
return if !defined?(Hotwire) || !defined?(Hotwire::Spark) || !Hotwire::Spark.enabled?
Hotwire::Spark.cable_server.config.logger = Logger.new(nil)
Hotwire::Spark.cable_server.config.cable = { "adapter" => "async" }
class SilentSpark < ActionController::LogSubscriber
def start_processing(event)
return if event.payload[:params][:hotwire_spark]
super(event)
end
def process_action(event)
return if event.payload[:params][:hotwire_spark]
super(event)
end
end
ActionController::LogSubscriber.detach_from :action_controller
SilentSpark.attach_to :action_controller
printfinn
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request