<commit_before>require 'fileutils'
require 'logger'

class AutoTruncatedLogger < Logger
  VERSION = "0.0.1"

  def initialize(device, shift_size = 1048576)
    super(device, 1, shift_size)
  end

  def add(severity, message = nil, progname = nil, &block)
    super(severity, message, progname, &block)
    truncate_old_file
  end

  def <<(msg)
    super(msg)
    truncate_old_file
  end

private
  def truncate_old_file
    oldfile = @logdev.filename + '.0'
    FileUtils.rm_rf oldfile if FileTest.exist? oldfile
  end
end
<commit_msg>shorten<commit_after>require 'fileutils'
require 'logger'

class AutoTruncatedLogger < Logger
  VERSION = "0.0.1"

  def initialize(device, shift_size = 1048576)
    super(device, 1, shift_size)
  end

  def add(*args)
    super(*args)
    truncate_old_file
  end

  def <<(msg)
    super(msg)
    truncate_old_file
  end

private
  def truncate_old_file
    oldfile = @logdev.filename + '.0'
    FileUtils.rm_rf oldfile if FileTest.exist? oldfile
  end
end

{'fraction_non_alphanumeric': 0.09456740442655935, 'fraction_numerical': 0.02414486921529175, 'mean_word_length': 3.627906976744186, 'pattern_counts': {'":': 0, '<': 9, '<?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': '4497002', 'n_tokens_mistral': 382, 'n_tokens_neox': 357, 'n_words': 88}