<commit_before>require 'logger'
require 'delegate'

class Loops
  class Logger < ::Delegator

    def initialize(logfile = $stdout, level = ::Logger::INFO, number_of_files = 10, max_file_size = 100 * 1024 * 1024,
                   write_to_console = false)
      super
      @number_of_files, @level, @max_file_size, @write_to_console =
          number_of_files, level, max_file_size, write_to_console
      self.logfile = logfile
    end

    def default_logfile=(logfile)
      @default_logfile = logfile
      self.logfile = logfile
    end

    def logfile=(logfile)
      logfile = @default_logfile || $stdout if logfile == 'default'
      coerced_logfile =
          case logfile
          when 'stdout' then $stdout
          when 'stderr' then $stderr
          when IO, StringIO then logfile  
          else
            if defined? LOOPS_ROOT
              logfile =~ /^\// ? logfile : File.join(LOOPS_ROOT, logfile)
            else
              logfile
            end <commit_msg>duh - Delegatori's ctor, of course, doesn't take the same arguments as subclass' ctor<commit_after>require 'logger'
require 'delegate'

class Loops
  class Logger < ::Delegator

    def initialize(logfile = $stdout, level = ::Logger::INFO, number_of_files = 10, max_file_size = 100 * 1024 * 1024,
                   write_to_console = false)
      @number_of_files, @level, @max_file_size, @write_to_console =
          number_of_files, level, max_file_size, write_to_console
      self.logfile = logfile
      super(@implementation)
    end

    def default_logfile=(logfile)
      @default_logfile = logfile
      self.logfile = logfile
    end

    def logfile=(logfile)
      logfile = @default_logfile || $stdout if logfile == 'default'
      coerced_logfile =
          case logfile
          when 'stdout' then $stdout
          when 'stderr' then $stderr
          when IO, StringIO then logfile  
          else
            if defined? LOOPS_ROOT
              logfile =~ /^\// ? logfile : File.join(LOOPS_ROOT, logfile)
            else
              logfile
            end 
{'fraction_non_alphanumeric': 0.08313310908217203, 'fraction_numerical': 0.012493993272465162, 'mean_word_length': 2.2179289026275115, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5244240', 'n_tokens_mistral': 656, 'n_tokens_neox': 614, 'n_words': 164}