<commit_before>var winston = require('winston');
var path = require('path');

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

var ENV = process.env.NODE_ENV;

function getLogger(module) {
    var moduleName = module.filename.split(path.sep).slice(-2).join('/');
    var logLevel = (ENV == 'development') ? 'debug' : 'info';
    return new winston.Logger({
        transports: [
            new winston.transports.File({
                filename: path.join(config.get('log_path'), config.get('log_file')),
                json: false,
                level: logLevel,
                label: moduleName
            }),
            new winston.transports.Console({
                colorize: true,
                level: logLevel,
                label: moduleName
            })
        ]
    });
}

module.exports = getLogger;<commit_msg>Update logger for using winston.loggers<commit_after>var winston = require('winston');
var path = require('path');

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

var ENV = process.env.NODE_ENV;

function getLogger(module) {
    var moduleName = module.filename.split(path.sep).slice(-2).join('/');

    if(!(moduleName in winston.loggers)) {
        var logLevel = (ENV == 'development') ? 'debug' : 'info';
        winston.loggers.add(moduleName, {
            file: {
                filename: path.join(config.get('log_path'), config.get('log_file')),
                json: false,
                level: logLevel,
                label: moduleName
            },
            console: {
                colorize: true,
                level: logLevel,
                label: moduleName
            }
        });
    }

    return winston.loggers.get(moduleName);
}

module.exports = getLogger;
{'fraction_non_alphanumeric': 0.13750731421884144, 'fraction_numerical': 0.0011702750146284377, 'mean_word_length': 1.9432013769363168, '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': '1493480', 'n_tokens_mistral': 495, 'n_tokens_neox': 473, 'n_words': 99}