mirror of
https://github.com/aurora-dot/pastel.codes.git
synced 2024-11-24 17:12:20 +00:00
30 lines
731 B
JavaScript
30 lines
731 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 |