<commit_before>require 'redis'
require 'redis-namespace'
require 'logger'

module Capacitor
  autoload :CounterCache, 'capacitor/counter_cache'
  autoload :CommandsFetcher, 'capacitor/commands_fetcher'
  autoload :Watcher, 'capacitor/watcher'

  class << self
    attr_writer :logger

    def logger
      @logger ||= const_defined?(:Rails) ? Rails.logger : Logger.new(STDOUT)
    end

    def log_level=(level)
      unless level.nil? || level == @level
        begin
          logger.level = Logger.const_get level.upcase
          @level = level
        rescue Exception => e
          logger.error "Unable to set log level to #{level} - #{e}"
        end
      end
    end<commit_msg>rearrange log_level= and drop equality test<commit_after>require 'redis'
require 'redis-namespace'
require 'logger'

module Capacitor
  autoload :CounterCache, 'capacitor/counter_cache'
  autoload :CommandsFetcher, 'capacitor/commands_fetcher'
  autoload :Watcher, 'capacitor/watcher'

  class << self
    attr_writer :logger

    def logger
      @logger ||= const_defined?(:Rails) ? Rails.logger : Logger.new(STDOUT)
    end

    def log_level=(level)
      return unless level
      begin
        level = Logger.const_get level.upcase if level.is_a?(String)
        logger.level = level
      rescue Exception => e
        logger.error "Unable to set log level to #{level} - #{e}"
      end
    end
{'fraction_non_alphanumeric': 0.09863210943124551, 'fraction_numerical': 0.0, 'mean_word_length': 3.0173410404624277, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '5784152', 'n_tokens_mistral': 441, 'n_tokens_neox': 437, 'n_words': 114}