mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 11:30:12 +08:00
feat: add console logger in production
This commit is contained in:
1 parent
b64cc6028c
commit
eaced63c68
1 file changed
+3
-12
@@ -23,19 +23,10 @@ const logger = winston.createLogger({
|
|||||||
dirname: config.log.path,
|
dirname: config.log.path,
|
||||||
filename: 'combined.log',
|
filename: 'combined.log',
|
||||||
}),
|
}),
|
||||||
|
new winston.transports.Console({
|
||||||
|
format: winston.format.simple(),
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
//
|
|
||||||
// If we're not in production then log to the `console` with the format:
|
|
||||||
// `${info.level}: ${info.message} JSON.stringify({ ...rest }) `
|
|
||||||
//
|
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
|
||||||
logger.add(
|
|
||||||
new winston.transports.Console({
|
|
||||||
format: winston.format.simple(),
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default logger
|
export default logger
|
||||||
Reference in new issue
Block a user