lib/lograge/sql.rb in lograge-sql-1.1.0 vs lib/lograge/sql.rb in lograge-sql-1.2.0
- old
+ new
@@ -13,9 +13,16 @@
# Initialise configuration with fallback to default values
def setup(config)
Lograge::Sql.formatter = config.formatter || default_formatter
Lograge::Sql.extract_event = config.extract_event || default_extract_event
+
+ return if config.keep_default_active_record_log
+
+ # Disable existing ActiveRecord logging
+ ActiveSupport::LogSubscriber.log_subscribers.each do |subscriber|
+ Lograge.unsubscribe(:active_record, subscriber) if subscriber.is_a?(ActiveRecord::LogSubscriber)
+ end
end
def store
defined?(RequestStore) ? RequestStore.store : Thread.current
end