Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ehacke/postmark-bunyan

Bunyan stream for postmark
https://github.com/ehacke/postmark-bunyan

Last synced: 20 days ago
JSON representation

Bunyan stream for postmark

Awesome Lists containing this project

README

        

# postmark-bunyan
Send emails using Postmark from Bunyan stream.

Use NPM to install:

```
npm install postmark-bunyan
```

Example:

```javascript
var bunyan = require('bunyan');
var PostmarkBunyan = require('postmark-bunyan');

var logger = bunyan.createLogger({
name: 'postmark-bunyan',
streams: [{
level: 'warn',
stream: new PostmarkBunyan({
serverApiToken: '',
toEmail: ['[email protected]'],
fromEmail: '[email protected]'
}),
type: 'raw'
}]
});

logger.warn('Something happened');
```

The constructor takes the following options:
```javascript
{
serverApiToken: String, // Required: Server API token
toEmail: Array of String, // Required: Array email addresses
fromEmail: String, // Required: From email address
bodyIsHtml: Boolean, // Optional: Send body as html, probably want to supply a body formatter
bodyFormatter: Function, // Optional: Set your own body, receives log record argument
subjectFormatter: Function, // Optional: Set your own subject, receives log record argument
onSuccess: Function, // Optional: Callback for successful sends, receives result
onError: Function, // Optional: Callback for send errors, receives error
rateLimit: { // Optional: Set a rate limit for outgoing emails
value: Number, // 100 in '100 emails per hour'
interval: String // 'hour' in '100 emails per hour'. Possible values: 'second', 'minute', 'hour', 'day'
}
}
```