winston-datadog
winston-datadog copied to clipboard
[feature request] add support for logger.add() function
Right now this is the way to init the transports
var logger = new (winston.Logger)({
transports: [
/* ... */
]
});
It would be nice to use it with the add function of winston logger
logger.add(ddTransport, { /* options */ });
This could be useful if conditionally add logger or adding logger later as required ... Thanks
You can do:
const ddTransport = new DatadogTransport({
api_key: 'xx',
app_key: 'yy'
});
winston.add(ddTransport, null, true);
Last parameter indicates that transport has already been instantiated.
Yeah I had the same question. Suggestion above worked for me.