https://github.com/rokid/egg-raven
A sentry/raven plugin to egg
https://github.com/rokid/egg-raven
egg eggjs plugin raven sentry
Last synced: 3 months ago
JSON representation
A sentry/raven plugin to egg
- Host: GitHub
- URL: https://github.com/rokid/egg-raven
- Owner: rokid
- License: mit
- Created: 2018-03-15T04:38:50.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-15T08:06:46.000Z (over 8 years ago)
- Last Synced: 2025-03-26T12:38:07.824Z (over 1 year ago)
- Topics: egg, eggjs, plugin, raven, sentry
- Language: JavaScript
- Homepage:
- Size: 67.4 KB
- Stars: 0
- Watchers: 9
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# egg-raven
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]
[npm-image]: https://img.shields.io/npm/v/egg-raven.svg?style=flat-square
[npm-url]: https://npmjs.org/package/egg-raven
[travis-image]: https://img.shields.io/travis/Rokid/egg-raven.svg?style=flat-square
[travis-url]: https://travis-ci.org/Rokid/egg-raven
[codecov-image]: https://img.shields.io/codecov/c/github/Rokid/egg-raven.svg?style=flat-square
[codecov-url]: https://codecov.io/github/Rokid/egg-raven?branch=master
[david-image]: https://img.shields.io/david/Rokid/egg-raven.svg?style=flat-square
[david-url]: https://david-dm.org/Rokid/egg-raven
[snyk-image]: https://snyk.io/test/npm/egg-raven/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/egg-raven
[download-image]: https://img.shields.io/npm/dm/egg-raven.svg?style=flat-square
[download-url]: https://npmjs.org/package/egg-raven
## Install
```bash
$ npm i egg-raven --save
```
## Usage
```js
// {app_root}/config/plugin.js
exports.raven = {
enable: true,
package: 'egg-raven',
}
```
## Configuration
```js
// {app_root}/config/config.default.js
exports.raven = {
dsn: 'https://your:very_secure@sentry.server/app_id',
options: {
// refer to https://docs.sentry.io/clients/node/config/#optional-settings for more options detail.
autoBreadcrumbs: {
http: true
},
release: '721e41770371db95eee98ca2707686226b993eda'
}
}
```
see [config/config.default.js](config/config.default.js) for more detail.
## Example
```js
// app/controller/home.js
const { Controller } = require('egg')
class HomeController extends Controller {
async index () {
this.ctx.raven.captureBreadcrumb({
message: 'Received payment confirmation',
category: 'payment',
data: {
amount: 312
}
})
this.ctx.runInBackground(async function backgroundJob () {
throw new Error('will be recorded into sentry with breadcrumbs')
})
}
async update() {
throw new Error('will be recorded into sentry with detailed context')
}
}
module.exports = HomeController
```
## Questions & Suggestions
Please open an issue [here](https://github.com/Rokid/egg-raven/issues).
## License
[MIT](LICENSE)