lib/log_sanity/railtie.rb in log_sanity-1.2.0 vs lib/log_sanity/railtie.rb in log_sanity-1.3.0

- old
+ new

@@ -3,11 +3,18 @@ config.logsanity = ActiveSupport::OrderedOptions.new config.logsanity.enabled = false config.logsanity.json_strings = false config.logsanity.silence_paths = [] - initializer "log_sanity.configure" do |app| + initializer "log_sanity.extensions" do + ActiveSupport.on_load(:action_controller) do + # runs for each of AC::Base, AC::API + include LogSanity::Extensions::ActionControllerHelper + end + end + + initializer "log_sanity.configure", before: :load_config_initializers do |app| app.config.log_tags ||= [] if app.config.logsanity.enabled orig_formatter = Rails.logger.formatter Rails.logger.formatter = LogSanity::Formatter.new if app.config.logsanity.json_strings @@ -49,11 +56,13 @@ end end ActiveSupport.on_load(:action_cable) do orig_logger = logger || Rails.logger - self.logger = orig_logger.clone.tap do |l| - l.level = Logger::WARN + if orig_logger.level < Logger::WARN + self.logger = orig_logger.clone.tap do |l| + l.level = Logger::WARN + end end end ActiveSupport.on_load(:action_cable_connection) do prepend LogSanity::Extensions::ActionCableConnection end