7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/online_migrations/verbose_sql_logs.rb', line 7
def enable
@activerecord_logger_was = ActiveRecord::Base.logger
@verbose_query_logs_was = verbose_query_logs
return if @activerecord_logger_was.nil?
stdout_logger = ActiveSupport::Logger.new($stdout)
stdout_logger.formatter = @activerecord_logger_was.formatter
stdout_logger.level = @activerecord_logger_was.level
stdout_logger = ActiveSupport::TaggedLogging.new(stdout_logger)
combined_logger =
if Utils.ar_version >= 7.1
ActiveSupport::BroadcastLogger.new(stdout_logger, @activerecord_logger_was)
else
stdout_logger.extend(ActiveSupport::Logger.broadcast(@activerecord_logger_was))
end
ActiveRecord::Base.logger = combined_logger
set_verbose_query_logs(false)
end
|