A Mailgun transport for winston.
$ curl http://npmjs.org/install.sh | sh
$ npm install winston
$ npm install winston-mailgun (Not ready on NPM)
There are a few required options for logging to Papertrail:
- apiKey: The apiKey provided by mailGun
- domain: The domain setup or provided by mailGun
- to: The to email is where the emails will be sent to
var winston = require('winston');
winston.transports.MailGun = require('winston-mailgun');
var winstonMailgun = new winston.transports.MailGun({
apiKey: process.env.MAILGUN_API_KEY,
domain: process.env.MAILGUN_API_DOMAIN,
to: 'TO EMAIL',
from: 'FROM EMAIL',
level: 'LEVEL',
silent: false,
subject: 'SUBJECT LINE',
});
var logger = new winston.Logger({
transports: [winstonMailgun]
});
logger.info('this is my message');
There are a number of optional settings:
from
- The from email is who the emails will be sent from, defaults towinston@ + os.hostname()
level
- The log level to use for this transport, defaults toinfo
silent
- defaults tofalse
subject
- The subject line of the email, defaults to ``handleExceptions
- defaults tofalse
proxy
-timeout
-