<commit_before>var e = module.exports = {};
const winston = require('winston');
const moment = require('moment-timezone');
const config = require('winston/lib/winston/config');

e.init = () => {
    var logger = e.logger = new (winston.Logger)({
        levels: {
            uncaughterror: 0,
            error: 1,
            warn: 2,
            command: 3,
            init: 4,
            output: 5,
            irc: 6,
            info: 7,
            music: 8,
            verbose: 9,
            debug: 10,
            silly: 11
        },
        colors: {
            error: 'red',
            uncaughterror: 'red',
            warn: 'yellow',
            info: 'green',
            verbose: 'cyan',
            debug: 'blue',
            silly: 'magenta',
            command: 'blue',
            music: 'cyan',
            init: 'green',
            output: 'magenta',
            irc: 'yellow',
            timestamp: 'grey',
            bold: 'bold'
        },
        level: 'debug',
        exitOnError: false,
        transports: [
            new (winston.transports.Console)({
                prettyPrint: true,
                colorize: true,
                name: 'general',
                silent: false,
                handleExceptions: true,
                timestamp: () => {
                    return `[${moment().tz('Canada/Mountain').format('MM/DD HH:mm:ss')}]`;
                },
                formatter: options => {
                    // Return string will be passed to logger.
                    return config.colorize('timestamp', options.timestamp()) + config.colorize(options.level, '[' + options.level.toUpperCase() + '] ')
                        + (options.level == 'error' && options.meta && options.meta.stack ? (options.meta.stack.join ? options.meta.stack.join('\n') : options.meta.stack) : (undefined !== options.message ? options.message : '') +
                            (options.meta && Object.keys(options.meta).length ? '\n\t' + JSON.stringify(options.meta, null, 2) : ''));
                }
            })
        ]
    });
<commit_msg>lovely file logs<commit_after>var e = module.exports = {};
const winston = require('winston');
const moment = require('moment-timezone');
const path = require('path');
const config = require('winston/lib/winston/config');

e.init = () => {
    var logger = e.logger = new (winston.Logger)({
        levels: {
            uncaughterror: 0,
            error: 1,
            warn: 2,
            command: 3,
            init: 4,
            output: 5,
            irc: 6,
            info: 7,
            music: 8,
            verbose: 9,
            debug: 10,
            silly: 11
        },
        colors: {
            error: 'red',
            uncaughterror: 'red',
            warn: 'yellow',
            info: 'green',
            verbose: 'cyan',
            debug: 'blue',
            silly: 'magenta',
            command: 'blue',
            music: 'cyan',
            init: 'green',
            output: 'magenta',
            irc: 'yellow',
            timestamp: 'grey',
            bold: 'bold'
        },
        level: 'debug',
        exitOnError: false,
        transports: [
            new (winston.transports.Console)({
                prettyPrint: true,
                colorize: true,
                name: 'general',
                silent: false,
                handleExceptions: true,
                timestamp: () => {
                    return `[${moment().tz('Canada/Mountain').format('MM/DD HH:mm:ss')}]`;
                },
                formatter: options => {
                    // Return string will be passed to logger.
                    return config.colorize('timestamp', options.timestamp()) + config.colorize(options.level, '[' + options.level.toUpperCase() + '] ')
                        + (options.level == 'error' && options.meta && options.meta.stack ? (options.meta.stack.join ? options.meta.stack.join('\n') : options.meta.stack) : (undefined !== options.message ? options.message : '') +
                            (options.meta && Object.keys(options.meta).length ? '\n\t' + JSON.stringify(options.meta, null, 2) : ''));
                }
            }),
            new (winston.transports.File)({
                name: 'file-general',
                filename: path.join(__dirname, 'logs', 'generallogs.log'),
                maxsize: 10000000,
                prettyPrint: true,
                colorize: true,
                json: false,
                silent: false,
                handleExceptions: true,
                timestamp: () => {
                    return `[${moment().tz('Canada/Mountain').format('MM/DD HH:mm:ss')}]`;
                },
                formatter: options => {
                    // Return string will be passed to logger.
                    return options.timestamp() + '[' + options.level.toUpperCase() + '] '
                        + (options.level == 'error' && options.meta && options.meta.stack
                            ? (options.meta.stack.join ? options.meta.stack.join('\n') : options.meta.stack)
                            : (undefined !== options.message ? options.message : '') +
                            (options.meta && Object.keys(options.meta).length
                                ? '\n\t' + JSON.stringify(options.meta, null, 2) : ''));
                }
            }),
            new (winston.transports.File)({
                name: 'file-error',
                filename: path.join(__dirname, 'logs', 'errorlogs.log'),
                maxsize: 10000000,
                prettyPrint: true,
                colorize: true,
                level: 'error',
                silent: false,
                handleExceptions: true,
                timestamp: () => {
                    return `[${moment().tz('Canada/Mountain').format('MM/DD HH:mm:ss')}]`;
                },
                formatter: options => {
                    // Return string will be passed to logger.
                    return options.timestamp() + '[' + options.level.toUpperCase() + '] '
                        + (options.level == 'error' && options.meta && options.meta.stack
                            ? (options.meta.stack.join ? options.meta.stack.join('\n') : options.meta.stack)
                            : (undefined !== options.message ? options.message : '') +
                            (options.meta && Object.keys(options.meta).length
                                ? '\n\t' + JSON.stringify(options.meta, null, 2) : ''));
                }
            })
        ]
    });

{'fraction_non_alphanumeric': 0.14355083459787557, 'fraction_numerical': 0.007283763277693475, 'mean_word_length': 1.3069653482674133, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3124748', 'n_tokens_mistral': 1818, 'n_tokens_neox': 1693, 'n_words': 355}