<commit_before># frozen_string_literal: true

require "abstract_unit"
require "active_support/logger_silence"
require "logger"

class LoggerSilenceTest < ActiveSupport::TestCase
  class MyLogger < ::Logger
    include LoggerSilence
  end

  setup do
    @io = StringIO.new
    @logger = MyLogger.new(@io)
  end

  test "#silence silences the log" do
    @logger.silence(Logger::ERROR) do
      @logger.info("Foo")
    end
    @io.rewind

    assert_empty @io.read
  end<commit_msg>Don't use deprecated `LoggerSilence`<commit_after># frozen_string_literal: true

require "abstract_unit"
require "active_support/logger_silence"
require "logger"

class LoggerSilenceTest < ActiveSupport::TestCase
  class MyLogger < ::Logger
    include ActiveSupport::LoggerSilence
  end

  setup do
    @io = StringIO.new
    @logger = MyLogger.new(@io)
  end

  test "#silence silences the log" do
    @logger.silence(Logger::ERROR) do
      @logger.info("Foo")
    end
    @io.rewind

    assert_empty @io.read
  end
{'fraction_non_alphanumeric': 0.097, 'fraction_numerical': 0.0, 'mean_word_length': 3.906862745098039, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4613876', 'n_tokens_mistral': 330, 'n_tokens_neox': 319, 'n_words': 80}