<commit_before>require 'syslog'

module Scrolls

  LOG_FACILITY = ENV['LOG_FACILITY'] || Syslog::LOG_USER
  LOG_FACILITY_MAP = {
    "auth"     => Syslog::LOG_AUTH,
    "authpriv" => Syslog::LOG_AUTHPRIV,
    "cron"     => Syslog::LOG_CRON,
    "daemon"   => Syslog::LOG_DAEMON,
    "ftp"      => Syslog::LOG_FTP,
    "kern"     => Syslog::LOG_KERN,
    "mail"     => Syslog::LOG_MAIL,
    "news"     => Syslog::LOG_NEWS,
    "syslog"   => Syslog::LOG_SYSLOG,
    "user"     => Syslog::LOG_USER,
    "uucp"     => Syslog::LOG_UUCP,
    "local0"   => Syslog::LOG_LOCAL0,
    "local1"   => Syslog::LOG_LOCAL1,
    "local2"   => Syslog::LOG_LOCAL2,
    "local3"   => Syslog::LOG_LOCAL3,
    "local4"   => Syslog::LOG_LOCAL4,
    "local5"   => Syslog::LOG_LOCAL5,
    "local6"   => Syslog::LOG_LOCAL6,
    "local7"   => Syslog::LOG_LOCAL7,
  }

  class SyslogLogger
    def initialize(ident = 'scrolls', facility = Syslog::LOG_USER)
      options = Syslog::LOG_PID|Syslog::LOG_CONS
      begin
        @syslog = Syslog.open(ident, options, facility)
      rescue RuntimeError
        @syslog = Syslog.reopen(ident, options, facility)
      end
    end

    def puts(data)
      @syslog.log(Syslog::LOG_INFO, data, nil)
    end
  end
end<commit_msg>Much better solution to ArgumentError.<commit_after>require 'syslog'

module Scrolls

  LOG_FACILITY = ENV['LOG_FACILITY'] || Syslog::LOG_USER
  LOG_FACILITY_MAP = {
    "auth"     => Syslog::LOG_AUTH,
    "authpriv" => Syslog::LOG_AUTHPRIV,
    "cron"     => Syslog::LOG_CRON,
    "daemon"   => Syslog::LOG_DAEMON,
    "ftp"      => Syslog::LOG_FTP,
    "kern"     => Syslog::LOG_KERN,
    "mail"     => Syslog::LOG_MAIL,
    "news"     => Syslog::LOG_NEWS,
    "syslog"   => Syslog::LOG_SYSLOG,
    "user"     => Syslog::LOG_USER,
    "uucp"     => Syslog::LOG_UUCP,
    "local0"   => Syslog::LOG_LOCAL0,
    "local1"   => Syslog::LOG_LOCAL1,
    "local2"   => Syslog::LOG_LOCAL2,
    "local3"   => Syslog::LOG_LOCAL3,
    "local4"   => Syslog::LOG_LOCAL4,
    "local5"   => Syslog::LOG_LOCAL5,
    "local6"   => Syslog::LOG_LOCAL6,
    "local7"   => Syslog::LOG_LOCAL7,
  }

  class SyslogLogger
    def initialize(ident = 'scrolls', facility = Syslog::LOG_USER)
      options = Syslog::LOG_PID|Syslog::LOG_CONS
      begin
        @syslog = Syslog.open(ident, options, facility)
      rescue RuntimeError
        @syslog = Syslog.reopen(ident, options, facility)
      end
    end

    def puts(data)
      @syslog.log(Syslog::LOG_INFO, "%s", data)
    end
  end
end
{'fraction_non_alphanumeric': 0.15194908512330946, 'fraction_numerical': 0.012728719172633254, 'mean_word_length': 2.992063492063492, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 41, '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': '4081099', 'n_tokens_mistral': 1028, 'n_tokens_neox': 968, 'n_words': 155}