1a71c294aa5a320fb6aab46f88cad0861d86e16c
1 const Configuration
= require('./Configuration');
2 const Winston
= require('winston');
4 const logger
= Winston
.createLogger({
6 format
: Winston
.format
.combine(Winston
.format
.splat(), Winston
.format
.json()),
7 defaultMeta
: {service
: 'user-service'},
10 // - Write to all logs with level `info` and below to `combined.log`
11 // - Write all logs error (and below) to `error.log`.
13 new Winston
.transports
.File({filename
: Configuration
.getErrorFile(), level
: 'error'}),
14 new Winston
.transports
.File({filename
: Configuration
.getLogFile()}),
19 // If enabled, log to the `console` with the format:
20 // `${info.level}: ${info.message} JSON.stringify({ ...rest }) `
22 if (Configuration
.getConsoleLog()) {
23 logger
.add(new Winston
.transports
.Console({
24 format
: Winston
.format
.simple(),
28 module
.exports
= logger
;