From 824048e14eb43655f6f4d16dfcaef84588ae0e7d Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Wed, 20 Jul 2022 13:13:56 +1000 Subject: [PATCH] Use ActiveSupport::Logger Changes introduced in https://github.com/rails/rails/pull/44695 unfortunately mean using a plain `Logger` here does not work with broadcasting. --- lib/split_rails_logs.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/split_rails_logs.rb b/lib/split_rails_logs.rb index 5b19587..df23f8f 100644 --- a/lib/split_rails_logs.rb +++ b/lib/split_rails_logs.rb @@ -1,6 +1,5 @@ require "active_support" require "fileutils" -require "logger" require "stringio" class SplitRailsLogs @@ -24,7 +23,7 @@ def self.for_failed(example) # reusing the io and logger instances each time prevents # runaway memory usage @io ||= StringIO.new - @logger ||= Logger.new(@io).tap do |logger| + @logger ||= ActiveSupport::Logger.new(@io).tap do |logger| Rails.logger.extend(ActiveSupport::Logger.broadcast(logger)) end