nlf / bucker

A simple logging library for node.js
82 stars 28 forks source link

implementing email notifications #9

Closed johannesboyne closed 11 years ago

johannesboyne commented 11 years ago

Implementing e-mail notifications. Use it like:

var logger = require('./index').createLogger({
  console: {
    color: true
  },
  email: {
    smtp: '<smtp server>',
    address: '<your email address>',
    username: '<username>',
    password: '<password>'
  }
});

logger.error('503: Error message!').email();

It sends an e-mail from the given address to the given address. The E-Mail looks like:

[BUCKER-LOG] 2013-09-03 10:25 error: 503: Error message!
nlf commented 11 years ago

My first thought about this was that email should be a transport, like file or logstash, but on further review I actually like this approach of having to explicitly email the log much better.

This is great, thanks for the contribution

nlf commented 11 years ago

Just so you know, this was published this morning as version 0.6.0

johannesboyne commented 11 years ago

Cool! Glad you liked the approach. My thoughts were exactly the same and implementing it as a transport feels natural but as you pointed out, it shouldn't happen to often thus it is an explicit action and not a regular one.