<commit_before>import winston from 'winston';
import fs from 'fs';
import util from 'util';
winston.setLevels(winston.config.npm.levels);
winston.addColors(winston.config.npm.colors);

export default class Logger{
	dir: Array<string>;
	transports: Array<Object>;
	newLogDir: any;
	logger: Object;

	constructor(file: any) {
		this.dir = file.split('/');
		this.checkForDir();
		this.logFileName = this.buildFileName();
		this.transports = [ new winston.transports.Console({ colorize: true, level: 'debug' }),
		new (winston.transports.File)({
			filename: this.newLogDir + '/' + this.logFileName + '.log',
			maxsize: 5242880
		}) ];

		this.logger = new (winston.Logger)({ transports: this.transports });
	}

	buildFileName() {
		const date = new Date();
		const year = `${date.getFullYear()}`;
		const month = (date.getMonth() + 1) > 9 ? `${date.getMonth() + 1}` : `0${date.getMonth() + 1}`;
		const day = (date.getDate() + 1) > 9 ? `${date.getDate()}` : `0${date.getDate() + 1}`;
		const hours = (date.getHours() + 1) > 9 ? `${date.getHours()}` : `0${date.getHours() + 1}`;
		const mins = (date.getMinutes() + 1) > 9 ? `${date.getMinutes()}` : `0${date.getMinutes() + 1}`;
		const sec = (date.getSeconds() + 1) > 9 ? `${date.getSeconds()}` : `0${date.getSeconds() + 1}`;
		return year + month + day + hours + mins + sec;
	}

	checkForDir() {
		const logsDir = __dirname + '/../../logs/';

		this.newLogDir = logsDir + this.dir[this.dir.length-2];

		if (!fs.existsSync(logsDir)) {
			fs.mkdirSync(logsDir);
		}<commit_msg>minor fix in logger naming<commit_after>import winston from 'winston';
import fs from 'fs';
import util from 'util';
winston.setLevels(winston.config.npm.levels);
winston.addColors(winston.config.npm.colors);

export default class Logger{
	dir: Array<string>;
	transports: Array<Object>;
	newLogDir: any;
	logger: Object;

	constructor(file: any) {
		this.dir = file.split('/');
		this.checkForDir();
		this.logFileName = this.buildFileName();
		this.transports = [ new winston.transports.Console({ colorize: true, level: 'debug' }),
		new (winston.transports.File)({
			filename: this.newLogDir + '/' + this.logFileName + '.log',
			maxsize: 5242880
		}) ];

		this.logger = new (winston.Logger)({ transports: this.transports });
	}

	buildFileName() {
		const date = new Date();
		const year = `${date.getFullYear()}`;
		const month = (date.getMonth() + 1) > 9 ? `${date.getMonth() + 1}` : `0${date.getMonth() + 1}`;
		const day = (date.getDate()) > 9 ? `${date.getDate()}` : `0${date.getDate()}`;
		const hours = (date.getHours()) > 9 ? `${date.getHours()}` : `0${date.getHours()}`;
		const mins = (date.getMinutes()) > 9 ? `${date.getMinutes()}` : `0${date.getMinutes()}`;
		const sec = (date.getSeconds()) > 9 ? `${date.getSeconds()}` : `0${date.getSeconds()}`;
		return year + month + day + hours + mins + sec;
	}

	checkForDir() {
		const logsDir = __dirname + '/../../logs/';

		this.newLogDir = logsDir + this.dir[this.dir.length-2];

		if (!fs.existsSync(logsDir)) {
			fs.mkdirSync(logsDir);
		}
{'fraction_non_alphanumeric': 0.20653249752556913, 'fraction_numerical': 0.01649620587264929, 'mean_word_length': 4.1302876480541455, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, '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': '1828453', 'n_tokens_mistral': 1209, 'n_tokens_neox': 1119, 'n_words': 236}