<commit_before>require "logger"
require "omni_logger/version"

class OmniLogger
  LOG_LEVELS = {
    debug: Logger::Severity::DEBUG,
    info: Logger::Severity::INFO,
    warn: Logger::Severity::WARN,
    fatal: Logger::Severity::FATAL,
    error: Logger::Severity::ERROR
  }

  def self.default_loggers
    @default_loggers ||= []
  end

  def self.add_default_loggers(*loggers)
    default_loggers.concat(loggers)
  end

  def self.reset_default_loggers
    @default_loggers = []
  end

  def initialize(args={})
    @loggers = [].concat(OmniLogger.default_loggers)
    self.level = args[:level] || :debug

    Array(args[:loggers]).each { |logger| add_logger(logger) }
  end

  def add_logger(logger)
    logger.level = @level
    @loggers << logger
  end

  def level=(level_to_log)
    @level = OmniLogger::LOG_LEVELS.fetch(level_to_log, level_to_log)
    @loggers.each { |logger| logger.level = @level }
  end

  def level
    OmniLogger::LOG_LEVELS.rassoc(@level).first
  end

  def close
    @loggers.map(&:close)
  end

  def add(level, *args)
    @loggers.each { |logger| logger.add(level, args) }
  end

  Logger::Severity.constants.each do |level|
    define_method(level.downcase) do |*args|
      @loggers.each { |logger| logger.send(level.downcase, args) }
    end

    define_method("#{ level.downcase }?".to_sym) do
      @level <= Logger::Severity.const_get(level)
    end
  end
end<commit_msg>add method to 'dump' messages without formatting.<commit_after>require "logger"
require "omni_logger/version"

class OmniLogger
  LOG_LEVELS = {
    debug: Logger::Severity::DEBUG,
    info: Logger::Severity::INFO,
    warn: Logger::Severity::WARN,
    fatal: Logger::Severity::FATAL,
    error: Logger::Severity::ERROR
  }

  def self.default_loggers
    @default_loggers ||= []
  end

  def self.add_default_loggers(*loggers)
    default_loggers.concat(loggers)
  end

  def self.reset_default_loggers
    @default_loggers = []
  end

  def initialize(args={})
    @loggers = [].concat(OmniLogger.default_loggers)
    self.level = args[:level] || :debug

    Array(args[:loggers]).each { |logger| add_logger(logger) }
  end

  def add_logger(logger)
    logger.level = @level
    @loggers << logger
  end

  def level=(level_to_log)
    @level = OmniLogger::LOG_LEVELS.fetch(level_to_log, level_to_log)
    @loggers.each { |logger| logger.level = @level }
  end

  def level
    OmniLogger::LOG_LEVELS.rassoc(@level).first
  end

  def close
    @loggers.map(&:close)
  end

  def add(level, *args)
    @loggers.each { |logger| logger.add(level, args) }
  end

  def <<(msg)
    @loggers.map { |logger| logger << msg }
  end

  Logger::Severity.constants.each do |level|
    define_method(level.downcase) do |*args|
      @loggers.each { |logger| logger.send(level.downcase, args) }
    end

    define_method("#{ level.downcase }?".to_sym) do
      @level <= Logger::Severity.const_get(level)
    end
  end
end
{'fraction_non_alphanumeric': 0.13367521367521368, 'fraction_numerical': 0.0, 'mean_word_length': 3.6741214057507987, 'pattern_counts': {'":': 0, '<': 13, '<?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': '1633010', 'n_tokens_mistral': 1064, 'n_tokens_neox': 1039, 'n_words': 198}