<commit_before>"use strict";

var program = require('commander');
program
    .version('0.0.1')
    .option('-d, --debug', 'enable debugging')
    .option('-s, --stdout', 'write log messages to stdout')
    .option('-f, --config <path>', 'path to configuration file')
    // UNIMPLEMENTED: .option('-o, --one-shot', 'run log synchronization in one shot mode')
    // UNIMPLEMENTED: .option('-b, --base <path>', 'treat base as filesystem root')
    .parse(process.argv);

var CONFIG_PATH = '/etc/shaftlog-client-config.yaml';
var DEFAULT_LOGFILE = '/var/log/shaftlog-client.log';
var DEFAULT_DATADIR = '/var/log/shaftlog-client';
var DEFAULT_SCAN_INTERVAL = 30000;
var DEFAULT_STATUS_INTERVAL = 300000;

var path = require('path');
var fs = require('fs');
var yaml = require('js-yaml');

var logger = require('./logger');

var config_path = path.resolve('.', program.config || CONFIG_PATH);
var config;
try {
    var config_data = fs.readFileSync(config_path, 'utf-8');
    config = yaml.load(config_data, {filename: config_path, strict: true});

    logger.initialize(config.logfile || DEFAULT_LOGFILE, program.debug ? 'DEBUG' : 'INFO', program.stdout);
} catch (e) {
    console.error('could not load config file: ' + e);
    process.exit(1);
    return;
}

var client = require('./client');
var sc = new client.SyncClient(config.datadir || DEFAULT_DATADIR, config.destinations || [], config.scan_paths || [],
                               config.scan_interval || DEFAULT_SCAN_INTERVAL, config.status_interval || DEFAULT_STATUS_INTERVAL);
sc.start();

process.on('SIGHUP', function () {
    logger.reopen();
});
process.on('SIGINT', function () {
    sc.close();
});
process.on('SIGTERM', function () {
    sc.close();
});
process.on('exit', function () {
    logger.close();
});<commit_msg>Make periodic trigger interval configurable<commit_after>"use strict";

var program = require('commander');
program
    .version('0.0.1')
    .option('-d, --debug', 'enable debugging')
    .option('-s, --stdout', 'write log messages to stdout')
    .option('-f, --config <path>', 'path to configuration file')
    // UNIMPLEMENTED: .option('-o, --one-shot', 'run log synchronization in one shot mode')
    // UNIMPLEMENTED: .option('-b, --base <path>', 'treat base as filesystem root')
    .parse(process.argv);

var CONFIG_PATH = '/etc/shaftlog-client-config.yaml';
var DEFAULT_LOGFILE = '/var/log/shaftlog-client.log';
var DEFAULT_DATADIR = '/var/log/shaftlog-client';
var DEFAULT_SCAN_INTERVAL = 30000;
var DEFAULT_STATUS_INTERVAL = 300000;
var DEFAULT_TRIGGER_INTERVAL = 1000;

var path = require('path');
var fs = require('fs');
var yaml = require('js-yaml');

var logger = require('./logger');

var config_path = path.resolve('.', program.config || CONFIG_PATH);
var config;
try {
    var config_data = fs.readFileSync(config_path, 'utf-8');
    config = yaml.load(config_data, {filename: config_path, strict: true});

    logger.initialize(config.logfile || DEFAULT_LOGFILE, program.debug ? 'DEBUG' : 'INFO', program.stdout);
} catch (e) {
    console.error('could not load config file: ' + e);
    process.exit(1);
    return;
}

var client = require('./client');
var sc = new client.SyncClient(config.datadir || DEFAULT_DATADIR, config.destinations || [], config.scan_paths || [],
                               config.scan_interval || DEFAULT_SCAN_INTERVAL, config.status_interval || DEFAULT_STATUS_INTERVAL,
                               config.periodic_trigger_interval || DEFAULT_TRIGGER_INTERVAL);
sc.start();

process.on('SIGHUP', function () {
    logger.reopen();
});
process.on('SIGINT', function () {
    sc.close();
});
process.on('SIGTERM', function () {
    sc.close();
});
process.on('exit', function () {
    logger.close();
});
{'fraction_non_alphanumeric': 0.17298451681793914, 'fraction_numerical': 0.009610250934329953, 'mean_word_length': 3.891644908616188, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6735815', 'n_tokens_mistral': 1208, 'n_tokens_neox': 1186, 'n_words': 275}