mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
31 lines
912 B
Markdown
31 lines
912 B
Markdown
# Mailgun Appender
|
|
|
|
This appender uses the [mailgun](https://www.mailgun.com) service to send log messages as emails. It requires the [mailgun-js](https://www.npmjs.com/package/mailgun-js) package to be added to your dependencies.
|
|
|
|
## Configuration
|
|
|
|
* `type` - `mailgun`
|
|
* `apiKey` - `string` - your mailgun API key
|
|
* `domain` - `string` - your domain
|
|
* `from` - `string`
|
|
* `to` - `string`
|
|
* `subject` - `string`
|
|
* `layout` - `object` (optional, defaults to basicLayout) - see [layouts](layouts.md)
|
|
|
|
The body of the email will be the result of applying the layout to the log event. Refer to the mailgun docs for how to obtain your API key.
|
|
|
|
## Example
|
|
|
|
```javascript
|
|
log4js.configure({
|
|
appenders: {
|
|
type: 'mailgun',
|
|
apiKey: '123456abc',
|
|
domain: 'some.company',
|
|
from: 'logging@some.service',
|
|
to: 'important.bosses@some.company',
|
|
subject: 'Error: Developers Need To Be Fired'
|
|
}
|
|
});
|
|
```
|