<commit_before>var argv = require('optimist').argv;
var memwatch = require('memwatch');

process.env.NODE_ENV = process.env.NODE_ENV || 'development';
process.env.COLLECTOR_MODE = process.env.COLLECTOR_MODE || argv.mode || 'normal';

var config = require('../config');
var logger = require('./utils/logger');
var connectors = require('./engine/connectors');
var scheduler = require('./engine/scheduler');

memwatch.on('leak', function(info) {
	logger.fatal({msg: 'memory leak detected', info: info});
});

memwatch.on('stats', function(stats) {
	logger.warning({msg: 'memory stats', stats: stats});
});

process.on('uncaughtException', function (err) {
	logger.fatal({msg:'Uncaught exception', error:err, stack:err.stack});
	console.log("Uncaught exception", err, err.stack && err.stack.toString());
});

var env = process.env.NODE_ENV;
var mode = process.env.COLLECTOR_MODE;
logger.success('likeastore-collector started env:' + env + ' mongodb: ' + config.connection + ' mode: ' + mode);

scheduler.run(mode, connectors);<commit_msg>lower message prio (too noisy)<commit_after>var argv = require('optimist').argv;
var memwatch = require('memwatch');

process.env.NODE_ENV = process.env.NODE_ENV || 'development';
process.env.COLLECTOR_MODE = process.env.COLLECTOR_MODE || argv.mode || 'normal';

var config = require('../config');
var logger = require('./utils/logger');
var connectors = require('./engine/connectors');
var scheduler = require('./engine/scheduler');

memwatch.on('leak', function(info) {
	logger.warning({msg: 'memory leak detected', info: info});
});

memwatch.on('stats', function(stats) {
	logger.warning({msg: 'memory stats', stats: stats});
});

process.on('uncaughtException', function (err) {
	logger.fatal({msg:'Uncaught exception', error:err, stack:err.stack});
	console.log("Uncaught exception", err, err.stack && err.stack.toString());
});

var env = process.env.NODE_ENV;
var mode = process.env.COLLECTOR_MODE;
logger.success('likeastore-collector started env:' + env + ' mongodb: ' + config.connection + ' mode: ' + mode);

scheduler.run(mode, connectors);
{'fraction_non_alphanumeric': 0.1849544801149976, 'fraction_numerical': 0.0, 'mean_word_length': 5.93687707641196, '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': '6570175', 'n_tokens_mistral': 662, 'n_tokens_neox': 648, 'n_words': 139}