<commit_before>require "../spec_helper"

describe Crest::Logger do
  describe "filters" do
    it "filter logs by regex" do
      IO.pipe do |r, w|
        params = {:width => "100", :height => 100, :api_key => "secret"}
        logger = Crest::CommonLogger.new(w)
        logger.filter(/(api_key=)(\w+)/, "\\1[REMOVED]")

        Crest::Request.get("#{TEST_SERVER_URL}/resize", params: params, logger: logger, logging: true)

        r.gets.should match(/[REMOVED]/)
        r.gets.should match(/[REMOVED]/)
      end
    end
  end
end<commit_msg>test log format in specs<commit_after>require "../spec_helper"

describe Crest::Logger do
  describe "filters" do
    it "filter logs by regex" do
      IO.pipe do |r, w|
        params = {:width => "100", :height => 100, :api_key => "secret"}
        logger = Crest::CommonLogger.new(w)
        logger.filter(/(api_key=)(\w+)/, "\\1[REMOVED]")

        Crest::Request.get("#{TEST_SERVER_URL}/resize", params: params, logger: logger, logging: true)

        r.gets.should match(/crest \| \d{4}\-\d{2}\-\d{2} \d{2}\:\d{2}\:\d{2} \|.* GET.* \| http\:\/\/0\.0\.0\.0\:4567\/resize\?width\=100&height\=100&api_key\=\[REMOVED\]/)
        r.gets.should match(/crest \| \d{4}\-\d{2}\-\d{2} \d{2}\:\d{2}\:\d{2} \|.* 200.* \| http\:\/\/0\.0\.0\.0\:4567\/resize\?width\=100&height\=100&api_key\=\[REMOVED\] \| "Width\: 100, height\: 100"/)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.23148148148148148, 'fraction_numerical': 0.04487179487179487, 'mean_word_length': 2.6118251928020566, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3928708', 'n_tokens_mistral': 577, 'n_tokens_neox': 526, 'n_words': 103}