A Bunyan stream for emailing logs using the Mailgun api.
npm install bunyan-mailgun
I have only tested this package for nodejs version 5.0.
This package does use ES6/ES2016 class
structures. So >=4.0 might work too.
By default BunyanMailgun will create a dynamic email including the subject and email body derived from the bunyan log.
var Bunyan = require('bunyan'),
BunyanMailgun = require('bunyan-mailgun')
var logger = Bunyan.createLogger({
name: 'test',
streams: [{
type: 'raw',
level: 'fatal',
stream: new BunyanMailgun({
to: 'to@example.com',
from: 'from@example.com',
key: 'key-XXXXXXXXXXXXXXXXXXXXXXX', // Mailgun API key
domain: 'mydomain.mailgun.org' // Your Mailgun Domain
})
}]
})
logger.fatal(new Error('Oh noze!'), 'Bad happened')
npm test
BunyanMailgun was essentially created for fatal level logs. Any other levels would eat up your Mailgun account message allotment.
The author or contributors of this software are NOT IN ANYWAY responsible for any charges or damages made by sending emails through the Mailgun service. In otherwords only send fatals. And watch them closely.