<commit_before>'use strict';

/* global io:true*/
/* global define:true*/
define(['socket.io-client'
    ], function () {
  return function (UI) {
    var self = this;

    // saving knockout model
    self.UI = UI;

    var socket = io.connect('http://localhost');

    /* global window:true*/
    // Rewriting emit to add debugging information in console
    if (window.knockoutBootstrapDebug) {
      (function () {
        var $emit = socket.$emit;
        socket.$emit = function () {
          var args = Array.prototype.slice.call(arguments);
          $emit.apply(socket, ['*'].concat(args));
          if (!$emit.apply(socket, arguments)) {
            $emit.apply(socket, ['default'].concat(args));
          }
        };

        var emit = socket.emit;
        socket.emit = function () {
          var args = Array.prototype.slice.call(arguments);
          console.log('==> ', args);
          emit.apply(socket, arguments);
        };

        socket.on('default', function (event, data) {
          console.log('Event not trapped: ' + event + ' - data:' + JSON.stringify(data));
        });

        socket.on('*', function (event, data) {
          console.log('<== ' + event, data);
        });
      })();
    }

    // Events

    socket.on('message', function (data) {
      UI.messageReceived(UI.messageReceived() + data.message + '\n');<commit_msg>Same syntax for input/output socket.io debug info<commit_after>'use strict';

/* global io:true*/
/* global define:true*/
define(['socket.io-client'
    ], function () {
  return function (UI) {
    var self = this;

    // saving knockout model
    self.UI = UI;

    var socket = io.connect('http://localhost');

    /* global window:true*/
    // Rewriting emit to add debugging information in console
    if (window.knockoutBootstrapDebug) {
      (function () {
        var $emit = socket.$emit;
        socket.$emit = function () {
          var args = Array.prototype.slice.call(arguments);
          $emit.apply(socket, ['*'].concat(args));
          if (!$emit.apply(socket, arguments)) {
            $emit.apply(socket, ['default'].concat(args));
          }
        };

        var emit = socket.emit;
        socket.emit = function () {
          console.log('==> ', arguments[0], arguments[1]);
          emit.apply(socket, arguments);
        };

        socket.on('default', function (event, data) {
          console.log('Event not trapped: ' + event + ' - data:' + JSON.stringify(data));
        });

        socket.on('*', function (event, data) {
          console.log('<== ', event, data);
        });
      })();
    }

    // Events

    socket.on('message', function (data) {
      UI.messageReceived(UI.messageReceived() + data.message + '\n');
{'fraction_non_alphanumeric': 0.1701350857977364, 'fraction_numerical': 0.0007301935012778386, 'mean_word_length': 2.1786542923433876, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5000292', 'n_tokens_mistral': 791, 'n_tokens_neox': 768, 'n_words': 175}