<commit_before># frozen_string_literal: true

require 'logger'

module Netsoul
  module Logging # :nodoc:
    PREFIX = '[Netsoul-Ruby]'.freeze

    class << self
      attr_writer :logger
    end

    def self.logger
      @logger ||= ::Logger.new(STDERR).tap do |logger|
        logger.level = Logger::INFO
        logger.formatter = proc do |severity, datetime, _progname, msg|
          "#{severity} [#{datetime.strftime('%Y-%m-%d %H:%M:%S.%L'.freeze)}] #{msg}\n"
        end
      end
    end

    private

    def log(level, message)
      Netsoul::Logging.logger.send(level.to_sym, "#{PREFIX} #{message}") if Netsoul::Logging.logger
    end
  end
end
<commit_msg>Set default logging device to STDOUT instead of STDERR.<commit_after># frozen_string_literal: true

require 'logger'

module Netsoul
  module Logging # :nodoc:
    PREFIX = '[Netsoul-Ruby]'.freeze

    class << self
      attr_writer :logger
    end

    def self.logger
      @logger ||= ::Logger.new(STDOUT).tap do |logger|
        $stdout.sync = true
        logger.level = Logger::INFO
        logger.formatter = proc do |severity, datetime, _progname, msg|
          "#{severity} [#{datetime.strftime('%Y-%m-%d %H:%M:%S.%L'.freeze)}] #{msg}\n"
        end
      end
    end

    private

    def log(level, message)
      Netsoul::Logging.logger.send(level.to_sym, "#{PREFIX} #{message}") if Netsoul::Logging.logger
    end
  end
end

{'fraction_non_alphanumeric': 0.14204545454545456, 'fraction_numerical': 0.0, 'mean_word_length': 2.808108108108108, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6306902', 'n_tokens_mistral': 501, 'n_tokens_neox': 472, 'n_words': 112}