Created
November 15, 2018 20:22
-
-
Save avaly/527eee1e061accb7e1f446ca105c3094 to your computer and use it in GitHub Desktop.
winston-format-bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const winston = require('winston'); | |
const { combine, printf, splat } = winston.format; | |
const customFormat = combine( | |
splat(), | |
printf((info) => JSON.stringify(info)) | |
); | |
const logger = winston.createLogger({ | |
transports: [ | |
new winston.transports.Console({ | |
format: customFormat, | |
}), | |
new winston.transports.Console({ | |
format: customFormat, | |
}), | |
] | |
}); | |
logger.info('foo', 'bar', 'ham'); | |
logger.info('with interpolated strings: %s and %s', 'bar', 'ham'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const winston = require('winston'); | |
const { combine, printf, splat } = winston.format; | |
const customFormat = combine( | |
splat(), | |
printf((info) => JSON.stringify(info)) | |
); | |
const logger = winston.createLogger({ | |
format: customFormat, | |
transports: [ | |
new winston.transports.Console(), | |
new winston.transports.Console(), | |
] | |
}); | |
logger.info('foo', 'bar', 'ham'); | |
logger.info('with interpolated strings: %s and %s', 'bar', 'ham'); |
Author
avaly
commented
Nov 15, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment