lib/lookbook/engine.rb in lookbook-0.3.3 vs lib/lookbook/engine.rb in lookbook-0.3.4

- old
+ new

@@ -21,10 +21,11 @@ options = app.config.lookbook vc_options = app.config.view_component options.auto_refresh = true if options.auto_refresh.nil? options.sort_examples = false if options.sort_examples.nil? + options.debug = false unless options.debug == true options.preview_paths = options.preview_paths.map(&:to_s) options.preview_paths += vc_options.preview_paths options.preview_controller = vc_options.preview_controller if options.preview_controller.nil? @@ -41,22 +42,27 @@ Lookbook::Engine.cable.mount_path = "/cable" Lookbook::Engine.cable.connection_class = -> { Lookbook::Connection } end end - initializer "lookbook.cable.logger" do - Lookbook::Engine.cable.logger ||= Rails.logger - end - initializer "lookbook.parser.tags" do Lookbook::Parser.define_tags end initializer "lookbook.assets.serve" do config.app_middleware.use( Rack::Static, urls: ["/lookbook-assets"], root: Lookbook::Engine.root.join("public").to_s ) + end + + initializer "lookbook.logging" do + if config.lookbook.debug == true + Lookbook::Engine.cable.logger ||= Rails.logger + else + Lookbook::Engine.cable.logger = Lookbook::NullLogger.new + config.action_view.logger = Lookbook::NullLogger.new + end end initializer "lookbook.preview.extend" do ActiveSupport.on_load(:view_component) do ViewComponent::Preview.extend Lookbook::Preview