Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/ehacke/postmark-bunyan
- Owner: ehacke
- License: mit
- Created: 2015-08-17T14:37:19.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-03-12T02:49:29.000Z (over 5 years ago)
- Last Synced: 2024-04-25T12:02:03.759Z (7 months ago)
- Language: JavaScript
- Size: 151 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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'
}
}
```