2018-12-19 10:25:55 +08:00
|
|
|
const { createLogger, format, transports } = require('winston');
|
2014-11-15 00:12:37 +08:00
|
|
|
|
2018-12-19 10:25:55 +08:00
|
|
|
const logger = createLogger({
|
2014-11-15 00:12:37 +08:00
|
|
|
transports: [
|
2018-12-19 10:25:55 +08:00
|
|
|
new transports.Console({ format: format.combine(format.timestamp(), format.splat(), format.json()) }),
|
|
|
|
new transports.File({ filename: "log/application.log", format: format.combine(format.timestamp(), format.splat(), format.json()) })
|
2014-11-15 00:12:37 +08:00
|
|
|
]
|
2017-09-11 22:54:15 +08:00
|
|
|
});
|
2014-11-15 00:12:37 +08:00
|
|
|
|
2017-09-11 22:54:15 +08:00
|
|
|
module.exports = logger;
|
2018-12-19 10:25:55 +08:00
|
|
|
|