<commit_before>/*
 *  Charon: A game authentication server
 *  Copyright (C) 2014  <NAME>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/* jshint node: true */
"use strict";

var winston = require('winston');

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

function Logger(config) {
	this.config = new Config(config, {
		file: undefined,
		verbose: false
	});

	this.logger = new (winston.Logger)({
		transports: [
			new (winston.transports.Console)({
				handleExceptions: true,
				level: this.config.getBool('verbose') ? 'verbose' : 'info'
			})
		]
	});

	this.log = this.logger.log;
	this.verbose = this.logger.verbose;
	this.info = this.logger.info;
	this.warn = this.logger.warn;
	this.error = this.logger.error;

	// Log to a file if supplied
	if (this.config.get('file')) {
		this.logger.add(winston.transports.File, {
			filename: config.log.file,
			handleExceptions: true,
			json: false,
			timestamp: true
		});
	}
}

module.exports = Logger;
<commit_msg>Fix instance of referring to 'config' object.<commit_after>/*
 *  Charon: A game authentication server
 *  Copyright (C) 2014  <NAME>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/* jshint node: true */
"use strict";

var winston = require('winston');

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

function Logger(config) {
	this.config = new Config(config, {
		file: undefined,
		verbose: false
	});

	this.logger = new (winston.Logger)({
		transports: [
			new (winston.transports.Console)({
				handleExceptions: true,
				level: this.config.getBool('verbose') ? 'verbose' : 'info'
			})
		]
	});

	this.log = this.logger.log;
	this.verbose = this.logger.verbose;
	this.info = this.logger.info;
	this.warn = this.logger.warn;
	this.error = this.logger.error;

	// Log to a file if supplied
	if (this.config.get('file')) {
		this.logger.add(winston.transports.File, {
			filename: this.config.get('file'),
			handleExceptions: true,
			json: false,
			timestamp: true
		});
	}
}

module.exports = Logger;

{'fraction_non_alphanumeric': 0.11471861471861472, 'fraction_numerical': 0.0030921459492888066, 'mean_word_length': 3.4930555555555554, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4963513', 'n_tokens_mistral': 1055, 'n_tokens_neox': 982, 'n_words': 352}