-2

Is it possible to inject an argument into a log such as error, debug or info using the winston configuration (createLogger)?

I'd like to be able to intercept the log and inject an object into each log

Ruegen
  • 605
  • 9
  • 35
  • Sounds like something you could accomplish using a [custom formatter](https://github.com/winstonjs/winston#creating-custom-formats). What have you tried? – Phil Jun 09 '23 at 02:11
  • thank you kindly @Philisonstrike that seems to have worked – Ruegen Jun 09 '23 at 03:01

1 Answers1

0

solution I used

export const correlationInjection = winston.format(info => {
  info.correlationId = correlator.getId();
  return info;
});

Thank you Phillisonstrike

Ruegen
  • 605
  • 9
  • 35