Closed sujeet-agrahari closed 3 years ago
I did it with a custom Transport
.
const Transport = require('winston-transport');
const { sendToSlackChannel } = require('../slack-bot');
module.exports = class SlackBotTransport extends Transport {
constructor(opts) {
super(opts);
}
log(info, callback) {
sendToSlackChannel({ data: info });
// Perform the writing to the remote service
callback();
}
};
Mentioned transports are
http
,console
andfile
.Is there a way I could capture generated log object before it is written to file or streamed to console?
I could then easily send it.
I need to capture the request log object, is it possible?