<commit_before>module Ahoy
  module Stores
    class LogStore < BaseStore

      def track_visit(options, &block)
        data = {
          visit_token: ahoy.visit_token,
          visitor_token: ahoy.visitor_token,
          time: options[:time]
        }.merge(ahoy.extractor.attributes)

        yield(data) if block_given?

        visit_logger.info data.to_json
      end

      def track_event(name, properties, options, &block)
        data = {
          name: name,
          properties: properties
        }.merge(options.slice(:time, :id, :visit_token, :visitor_token))

        data[:user_id] = options[:user].id if options[:user]

        yield(data) if block_given?

        event_logger.info data.to_json
      end

      protected

      # TODO disable header
      def visit_logger
        ActiveSupport::Logger.new(Rails.root.join("log/visits.log"))
      end

      def event_logger
        ActiveSupport::Logger.new(Rails.root.join("log/events.log"))
      end

    end
  end
end
<commit_msg>Updated LogStore<commit_after>module Ahoy
  module Stores
    class LogStore < BaseStore

      def track_visit(options, &block)
        data = {
          visit_token: ahoy.visit_token,
          visitor_token: ahoy.visitor_token,
          time: options[:time]
        }.merge(ahoy.extractor.attributes)
        data[:user_id] = user.id if user

        yield(data) if block_given?

        visit_logger.info data.to_json
      end

      def track_event(name, properties, options, &block)
        data = {
          name: name,
          properties: properties,
          visit_token: ahoy.visit_token,
          visitor_token: ahoy.visitor_token
        }.merge(options.slice(:time, :id))
        data[:user_id] = user.id if user

        yield(data) if block_given?

        event_logger.info data.to_json
      end

      protected

      # TODO disable header
      def visit_logger
        ActiveSupport::Logger.new(Rails.root.join("log/visits.log"))
      end

      def event_logger
        ActiveSupport::Logger.new(Rails.root.join("log/events.log"))
      end

    end
  end
end

{'fraction_non_alphanumeric': 0.09462672372800761, 'fraction_numerical': 0.0, 'mean_word_length': 2.1639097744360902, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3074577', 'n_tokens_mistral': 653, 'n_tokens_neox': 624, 'n_words': 133}