pastel.codes/config/winston.js
E 8449b30401
Add linting, formatting and pre-commit (#53)
* Add dev-dependancies

* Security update npm packages

* Force audit fix

* Add linting, formatting and precommit

* Format files
2024-04-29 13:21:31 +01:00

31 lines
645 B
JavaScript

var winston = require('winston');
var appRoot = require('app-root-path');
var logger = new winston.createLogger({
transports: [
new winston.transports.File({
level: 'info',
filename: `${appRoot}/logs/app.log`,
handleExceptions: true,
json: true,
maxsize: 5242880, //5MB
maxFiles: 5,
colorize: false,
}),
new winston.transports.Console({
level: 'debug',
handleExceptions: true,
json: false,
colorize: true,
}),
],
exitOnError: false,
});
logger.stream = {
write: function (message, _encoding) {
logger.info(message);
},
};
module.exports = logger;