Skip to content

Instantly share code, notes, and snippets.

@maverick1872
Created February 12, 2022 20:04
Show Gist options
  • Save maverick1872/021b33f2b90f17e102d34bcd92207fcb to your computer and use it in GitHub Desktop.
Save maverick1872/021b33f2b90f17e102d34bcd92207fcb to your computer and use it in GitHub Desktop.
Splat optimizations cause metadata to be dropped when not leveraging `winston.formats.splat()`
const logger = winston.createLogger({
level: "debug",
defaultMeta: { id: 'APP', service: 'Authentication' },
transports: [mockTransports.inMemory(actualOutput)]
});
logger.info('this is a test', { extraThing: 7 });
logger.info('this is %c a test', { extraThing: 7 });
assume(actualOutput.every((msg) =>
msg.hasOwnProperty("extraThing")
)).is.true("Not all messages include the additional metadata")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment