$ npm i egg-raven --save
// {app_root}/config/plugin.js
exports.raven = {
enable: true,
package: 'egg-raven',
}
// {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 for more detail.
// 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
Please open an issue here.