import winston from "winston";

winston.emitErrs = true;
const tsFormat = () => (new Date().toLocaleString());
const log = new winston.Logger({
	transports: [
		// new winston.transports.File({
		// 	level: 'info',
		// 	filename: './all-logs.log',
		// 	handleExceptions: true,
		// 	json: true,
		// 	maxsize: 5242880, //5MB
		// 	maxFiles: 5,
		// 	colorize: false
		// }),
		new (winston.transports.Console)({
			colorize: true,
			json: false,
			prettyPrint: true,
			handleExceptions: true,
			timestamp: tsFormat,
			level: 'info'
		})
	],
	exitOnError: false
});

if (process.env.NODE_ENV !== 'production') {
	log.add(new winston.transports.Console({
		colorize: true,
		json: false,
		prettyPrint: true,
		handleExceptions: true,
		timestamp: tsFormat,
		//label: module.filename.split('/').slice(-2).join('/'),
		level: 'debug'
	}));
}

module.exports = log;
module.exports.stream = {
	write: function (message, encoding) {
		log.debug(message.trim());
	}
};






@@ -520,248 +520,8 @@
 t,%0A%09
-%09%09level: 'info'%0A%09%09%7D)%0A%09%5D,%0A%09exitOnError: false%0A%7D);%0A%0Aif (process.env.NODE_ENV !== 'production') %7B%0A%09log.add(new winston.transports.Console(%7B%0A%09%09colorize: true,%0A%09%09json: false,%0A%09%09prettyPrint: true,%0A%09%09handleExceptions: true,%0A%09%09timestamp: tsFormat,%0A
 %09%09//
@@ -577,16 +577,17 @@
 '/'),%0A%09%09
+%09
 level: '
@@ -597,15 +597,40 @@
 ug'%0A
+%09
 %09%7D)
+%0A%09%5D,%0A%09exitOnError: false%0A%7D
 );
-%0A%7D
 %0A%0Amo

update log level