From 19d85783614b6d96600aa39aab88791d0c66a78f Mon Sep 17 00:00:00 2001 From: Eugene Kenny Date: Thu, 2 Jul 2020 22:37:23 +0100 Subject: [PATCH] Add a regression test for per-fiber tagged logging Followup to 978421abd83d45b72e299f50a4fb324fcbdb3e00. --- activesupport/test/tagged_logging_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/activesupport/test/tagged_logging_test.rb b/activesupport/test/tagged_logging_test.rb index f52568025c..959603c92a 100644 --- a/activesupport/test/tagged_logging_test.rb +++ b/activesupport/test/tagged_logging_test.rb @@ -83,6 +83,15 @@ class TaggedLoggingTest < ActiveSupport::TestCase assert_equal "Dull story\n[OMG] Cool story\n[BCX] Funky time\n", @output.string end + test "keeps each tag in their own thread even when pushed directly" do + Thread.new do + @logger.push_tags("OMG") + @logger.info "Cool story" + end.join + @logger.info "Funky time" + assert_equal "[OMG] Cool story\nFunky time\n", @output.string + end + test "keeps each tag in their own instance" do other_output = StringIO.new other_logger = ActiveSupport::TaggedLogging.new(MyLogger.new(other_output))