A Bunyan stream for emailing logs using the nodemailer api.
npm install bunyan-nodemailer
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-nodemailer')
var logger = Bunyan.createLogger({
name: 'test',
streams: [{
type: 'raw',
level: 'fatal',
stream: new BunyanNodeMailer({
to: 'to@example.com',
from: 'from@example.com',
transport: {
host:'smtp.mail.com',
port: 587,
secure: true,
auth: {
user: 'abc',
pass: 'abcabc'
}
}
})
}]
})
logger.fatal(new Error('Oh noze!'), 'Bad happened')
npm test
BunyanNodeMailer was essentially created for fatal level logs. Any other levels would eat up your SMTP account message allotment if using a relay service.
The author or contributors of this software are NOT IN ANYWAY responsible for any charges or damages made by sending emails through the SMTP relay services. In otherwords only send fatals. And watch them closely.