<commit_before>import LWEvents from '../collections/lwevents/collection.js';
import { newMutation } from 'meteor/vulcan:core';
import Users from 'meteor/vulcan:users';
import { ForwardedWhitelist } from './forwarded_whitelist.js';

const dummyUser = Users.findOne();

Meteor.onConnection((connection) => {
  const document = {
    name: 'newConnection',
    important: false,
    properties: {
      ip: connection.clientAddress,
      id: connection.id,
    }
  }
  newMutation({
    collection: LWEvents,
    document: document,
    currentUser: dummyUser,
    validate: false,
  })

  connection.onClose(() => {
    const document = {
      name: 'closeConnection',
      important: false,
      properties: {
        ip: connection.clientAddress,
        id: connection.id,
      }
    }
    newMutation({
      collection: LWEvents,
      document: document,<commit_msg>Added logging for Meteor connections<commit_after>import LWEvents from '../collections/lwevents/collection.js';
import { newMutation } from 'meteor/vulcan:core';
import Users from 'meteor/vulcan:users';
import { ForwardedWhitelist } from './forwarded_whitelist.js';

const dummyUser = Users.findOne();

Meteor.onConnection((connection) => {
  const document = {
    name: 'newConnection',
    important: false,
    properties: {
      ip: connection.clientAddress,
      id: connection.id,
    }
  }
  newMutation({
    collection: LWEvents,
    document: document,
    currentUser: dummyUser,
    validate: false,
  })
  //eslint-disable-next-line no-console
  console.info("new Meteor connection:", document)

  connection.onClose(() => {
    const document = {
      name: 'closeConnection',
      important: false,
      properties: {
        ip: connection.clientAddress,
        id: connection.id,
      }
    }
    //eslint-disable-next-line no-console
    console.info("closed Meteor connection:", document)
    newMutation({
      collection: LWEvents,
      document: document,
{'fraction_non_alphanumeric': 0.12028542303771661, 'fraction_numerical': 0.0, 'mean_word_length': 3.1501057082452433, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4620309', 'n_tokens_mistral': 605, 'n_tokens_neox': 581, 'n_words': 129}