bunyan-nodemailer

Send bunyan log record with nodemailer

Usage no npm install needed!

<script type="module">
  import bunyanNodemailer from 'https://cdn.skypack.dev/bunyan-nodemailer';
</script>

README

bunyan-nodemailer

A Bunyan stream for emailing logs using the nodemailer api.

Install

npm install bunyan-nodemailer

Emails

By default BunyanMailgun will create a dynamic email including the subject and email body derived from the bunyan log.

Example

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')

Test

npm test

Damage and Liability

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.