wavded / winston-mail

Mail transport for Winston

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

to send email unhandle exception

rahultank1993 opened this issue · comments

i am trying to send email when unhandled exception but it could not work
my code is

var logger = new (winston.Logger)({
  transports: [
    new (winston.transports.Console)({
      colorize : true,
      timestamp:function(){
        return moment().format("DD.MM.YYYY hh:mm:ss");
      }
    })
  ],
  exceptionHandlers: [
    new winston.transports.Mail({
      to:'email id',
      from:'email id',
      host:'smtp.gmail.com',
      username:'email id',
      password:'password',
      ssl: true,
      handleExceptions : true,
    })
  ]
});

I skipped the

handleException: true

Including above probably does not make sense because you are inside exceptionHandler anyway. I initially added a question in SO but, then I figured it out so answered my own question:

http://stackoverflow.com/questions/35002546/node-js-winston-logging-using-mail-transport-to-send-only-uncaughtexception-as-a/35002956#35002956