<commit_before>if defined?(RSpec)
  RSpec.shared_context "logging:verbose", log: true do
    around(:each) do |ex|
      *loggers = ActiveSupport::LogSubscriber.logger,
                 Rails.logger,
                 ActiveRecord::Base.logger
      ActiveSupport::LogSubscriber.logger =
        Rails.logger =
          ActiveRecord::Base.logger = Logger.new(STDOUT)
      ex.run
      ActiveSupport::LogSubscriber.logger,
      Rails.logger,
      ActiveRecord::Base.logger = *loggers
    end
  end

  RSpec.shared_context "logging:active_record", log: :ar do
    around(:each) do |ex|
      logger = ActiveRecord::Base.logger
      ActiveRecord::Base.logger = Logger.new(STDOUT)
      ex.run
      ActiveRecord::Base.logger = logger
    end
  end
end

TestProf.activate("LOG", "all") do
  ActiveSupport::LogSubscriber.logger =
    Rails.logger =
      ActiveRecord::Base.logger = Logger.new(STDOUT)
end

TestProf.activate("LOG", "ar") do
  ActiveRecord::Base.logger = Logger.new(STDOUT)
end<commit_msg>Show message when global log enabled<commit_after>if defined?(RSpec)
  RSpec.shared_context "logging:verbose", log: true do
    around(:each) do |ex|
      *loggers = ActiveSupport::LogSubscriber.logger,
                 Rails.logger,
                 ActiveRecord::Base.logger
      ActiveSupport::LogSubscriber.logger =
        Rails.logger =
          ActiveRecord::Base.logger = Logger.new(STDOUT)
      ex.run
      ActiveSupport::LogSubscriber.logger,
      Rails.logger,
      ActiveRecord::Base.logger = *loggers
    end
  end

  RSpec.shared_context "logging:active_record", log: :ar do
    around(:each) do |ex|
      logger = ActiveRecord::Base.logger
      ActiveRecord::Base.logger = Logger.new(STDOUT)
      ex.run
      ActiveRecord::Base.logger = logger
    end
  end
end

TestProf.activate("LOG", "all") do
  TestProf.log :info, "Rails verbose logging enabled"
  ActiveSupport::LogSubscriber.logger =
    Rails.logger =
      ActiveRecord::Base.logger = Logger.new(STDOUT)
end

TestProf.activate("LOG", "ar") do
  TestProf.log :info, "Active Record verbose logging enabled"
  ActiveRecord::Base.logger = Logger.new(STDOUT)
end
{'fraction_non_alphanumeric': 0.1136469492314858, 'fraction_numerical': 0.0, 'mean_word_length': 3.138728323699422, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7226864', 'n_tokens_mistral': 666, 'n_tokens_neox': 649, 'n_words': 131}