<commit_before>class SetAttributes
  module Attribute
    def self.set(receiver, attribute, value, log_black_list_regex=nil)
      logger = Telemetry::Logger.get self

      log_black_list_regex ||= Defaults.log_black_list_regex

      setter = :"#{attribute}="

      if log_black_list_regex && !(attribute =~ log_black_list_regex).nil?
        log_value = '(value cannot be logged)'
      else
        log_value = value
      end

      if receiver.respond_to? setter
        logger.trace "Setting #{attribute}"

        receiver.send setter, value

        logger.debug "Set #{attribute}"
        logger.data "#{attribute}: #{log_value}"
      else
        logger.debug "#{receiver} has no setter for #{attribute}"
      end

      value
    end

    module Defaults
      def self.log_black_list_regex
        logger = Telemetry::Logger.get self
        logger.trace "Getting default attribute black list regex"
        /password|api_key|token/.tap do |instance|
          logger.debug "Got default attribute black list regex (#{instance})"
        end
      end
    end
  end
end<commit_msg>The log black list regex is corrected per intension<commit_after>class SetAttributes
  module Attribute
    def self.set(receiver, attribute, value, log_black_list_regex=nil)
      logger = Telemetry::Logger.get self

      log_black_list_regex ||= Defaults.log_black_list_regex

      setter = :"#{attribute}="

      if log_black_list_regex && !(attribute =~ log_black_list_regex).nil?
        log_value = '(value cannot be logged)'
      else
        log_value = value
      end

      if receiver.respond_to? setter
        logger.trace "Setting #{attribute}"

        receiver.send setter, value

        logger.debug "Set #{attribute}"
        logger.data "#{attribute}: #{log_value}"
      else
        logger.debug "#{receiver} has no setter for #{attribute}"
      end

      value
    end

    module Defaults
      def self.log_black_list_regex
        logger = Telemetry::Logger.get self
        logger.trace "Getting default attribute black list regex"
        /\A(password|api_key|data)\z|token\z/.tap do |instance|
          logger.debug "Got default attribute black list regex (#{instance})"
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.09094962104324565, 'fraction_numerical': 0.0, 'mean_word_length': 2.584664536741214, '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': '3806909', 'n_tokens_mistral': 651, 'n_tokens_neox': 633, 'n_words': 179}