736e9b89732f73435683c014fca1fd6b2ce909c4
1 import Configuration from
'./Configuration';
2 import Winston from
'winston';
4 const logger
= Winston
.createLogger({
5 level
: Configuration
.getLogLevel(),
6 format
: Winston
.format
.combine(Winston
.format
.splat(), Winston
.format
[Configuration
.getLogFormat()]()),
9 // - Write to all logs with level `info` and below to `combined.log`
10 // - Write all logs error (and below) to `error.log`.
12 new Winston
.transports
.File({ filename
: Configuration
.getErrorFile(), level
: 'error' }),
13 new Winston
.transports
.File({ filename
: Configuration
.getLogFile() }),
18 // If enabled, log to the `console` with the format:
19 // `${info.level}: ${info.message} JSON.stringify({ ...rest }) `
21 if (Configuration
.getConsoleLog()) {
22 logger
.add(new Winston
.transports
.Console({
23 format
: Winston
.format
.combine(Winston
.format
.splat(), Winston
.format
[Configuration
.getLogFormat()]()),
27 export default logger
;