lib/log_sanity/railtie.rb in log_sanity-0.2.5 vs lib/log_sanity/railtie.rb in log_sanity-1.0.0

- old
+ new

@@ -24,10 +24,18 @@ require 'action_view/log_subscriber' ActionView::LogSubscriber.detach_from :action_view end if defined?(ActiveJob) require 'active_job/logging' - ActiveJob::Logging::LogSubscriber.detach_from :active_job + begin + require 'active_job/log_subscriber' # >= 6.1 + rescue LoadError + end + if defined?(ActiveJob::LogSubscriber) # >= 6.1 + ActiveJob::LogSubscriber.detach_from :active_job + else # < 6.1 + ActiveJob::Logging::LogSubscriber.detach_from :active_job + end end if defined?(ActiveRecord) if ActiveRecord::Base.logger.debug? Rails.logger.info '[LogSanity] ActiveRecord::Base.logger in debug mode and will still log queries' end