<commit_before>require 'sucker_punch'
require 'loggr-rb/http'
require 'uri'

module Loggr

  class LogClient

    def self.post(e,async)
      if async
        LogJob.new.async.perform(e)
      else
        LogJob.new.perform(e)
      end
    end

    def post(e)
      logkey = ::Loggr::Config.log_key
      call_remote("post.loggr.net", "/1/logs/#{logkey}/events", create_params(e))
    end

    def create_params(e)
      apikey = ::Loggr::Config.api_key
      params = {"apikey" => apikey, "text" => e.text}
      params = params.merge({"link" => e.link}) if !e.link.nil?
      params = params.merge({"tags" => e.tags}) if !e.tags.nil?
      params = params.merge({"source" => e.source}) if !e.source.nil?
      params = params.merge({"geo" => e.geo}) if !e.geo.nil?
      params = params.merge({"value" => e.value}) if !e.value.nil?
      if e.datatype == DataType::HTML
        params = params.merge({"data" => sprintf("@html\r\n%s", e.data)}) if !e.data.nil?
      else<commit_msg>don't bother creating a worker we won't use<commit_after>require 'sucker_punch'
require 'loggr-rb/http'
require 'uri'

module Loggr

  class LogClient

    def self.post(e,async)
      if async
        LogJob.new.async.perform(e)
      else
        LogClient.new.post(event)
      end
    end

    def post(e)
      logkey = ::Loggr::Config.log_key
      call_remote("post.loggr.net", "/1/logs/#{logkey}/events", create_params(e))
    end

    def create_params(e)
      apikey = ::Loggr::Config.api_key
      params = {"apikey" => apikey, "text" => e.text}
      params = params.merge({"link" => e.link}) if !e.link.nil?
      params = params.merge({"tags" => e.tags}) if !e.tags.nil?
      params = params.merge({"source" => e.source}) if !e.source.nil?
      params = params.merge({"geo" => e.geo}) if !e.geo.nil?
      params = params.merge({"value" => e.value}) if !e.value.nil?
      if e.datatype == DataType::HTML
        params = params.merge({"data" => sprintf("@html\r\n%s", e.data)}) if !e.data.nil?
      else
{'fraction_non_alphanumeric': 0.1761194029850746, 'fraction_numerical': 0.0009950248756218905, 'mean_word_length': 2.7103321033210332, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '2818496', 'n_tokens_mistral': 734, 'n_tokens_neox': 723, 'n_words': 148}