22 lines
687 B
JavaScript
22 lines
687 B
JavaScript
const winston = require('winston');
|
||
const path = require('path');
|
||
|
||
const logger = winston.createLogger({
|
||
level: process.env.LOG_LEVEL || 'warn', // Изменено с 'info' на 'warn'
|
||
format: winston.format.combine(winston.format.timestamp(), winston.format.json()),
|
||
transports: [
|
||
new winston.transports.Console({
|
||
format: winston.format.combine(winston.format.colorize(), winston.format.simple()),
|
||
}),
|
||
new winston.transports.File({
|
||
filename: path.join(__dirname, '../logs/error.log'),
|
||
level: 'error',
|
||
}),
|
||
new winston.transports.File({
|
||
filename: path.join(__dirname, '../logs/combined.log'),
|
||
}),
|
||
],
|
||
});
|
||
|
||
module.exports = logger;
|