<commit_before>// Listens for socket connections. Passes queries to streamer for monitoring.
// Watches for updates to sourceErrorCount

var express = require('express');
var SocketIOServer = require('socket.io');
var passportSocketIo = require('passport.socketio');
var _ = require('underscore');
var streamer = require('./streamer');
var Source = require('../../models/source');
var Query = require('../../models/query');
var ReportQuery = require('../../models/query/report-query');
var IncidentQuery = require('../../models/query/incident-query');
var SocketQueryGroup = require('./socket-query-group');
var settingsController = require('./v1/settings-controller');
var Trend = require('../../models/trend');
var util = require('util');
var EventEmitter = require('events').EventEmitter;
var logger = require('../logger');
/**
 * 
 * TODO the Socket object prototype is not exposed in v2.3.0
 * 
 // override the emit function to add logging
  // var emit = socketIo.Socket.prototype.emit;
  // socketIo.Socket.prototype.emit = function(event, data) {
  //   logger.debug(event, data);
  //   emit.apply(this, arguments);
  // };

 */
var SocketHandler = function(app, server, auth) {
  this.app = app;
  this.server = server;<commit_msg>fix: override Socket.emit for debugging<commit_after>// Listens for socket connections. Passes queries to streamer for monitoring.
// Watches for updates to sourceErrorCount

var express = require('express');
var SocketIOServer = require('socket.io');
var Socket = require('socket.io/lib/socket')
var passportSocketIo = require('passport.socketio');
var _ = require('underscore');
var streamer = require('./streamer');
var Source = require('../../models/source');
var Query = require('../../models/query');
var ReportQuery = require('../../models/query/report-query');
var IncidentQuery = require('../../models/query/incident-query');
var SocketQueryGroup = require('./socket-query-group');
var settingsController = require('./v1/settings-controller');
var Trend = require('../../models/trend');
var util = require('util');
var EventEmitter = require('events').EventEmitter;
var logger = require('../logger');

// override the emit function to add logging
var emit = Socket.prototype.emit;
Socket.prototype.emit = function(event, data) {
  logger.debug(event, data);
  emit.apply(this, arguments);
};

var SocketHandler = function(app, server, auth) {
  this.app = app;
  this.server = server;
{'fraction_non_alphanumeric': 0.1700205338809035, 'fraction_numerical': 0.002053388090349076, 'mean_word_length': 4.401330376940133, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5363390', 'n_tokens_mistral': 681, 'n_tokens_neox': 677, 'n_words': 188}