This repository has been archived by the owner on Jan 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbugsnag.ts
51 lines (38 loc) · 2.16 KB
/
bugsnag.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import bugsnag from 'bugsnag-js';
// This service initializes Bugsnag and makes it available to the root module. Below are examples of some possible configurations, but only the api apiKey is required to get started.
const bugsnagClient = bugsnag({
// get your own api key at bugsnag.com
apiKey: 'aaa5f6d3250177a3ea6d5dd52c8d5b07',
// if you track deploys or use source maps, make sure to set the correct version.
appVersion: '1.2.3',
// Bugsnag can track the number of “sessions” that happen in your application, and calculate a crash rate for each release. This defaults to false.
autoCaptureSessions: true,
// defines the release stage for all events that occur in this app.
releaseStage: 'production',
// defines which release stages bugsnag should report. e.g. ignore staging errors.
notifyReleaseStages: [ 'development', 'production'],
// because this is a demo app, below extends the default of 10 notifications per pageload. click away!
maxEvents: 50,
// one of the most powerful tools in our library, beforeSend lets you evaluate, modify, add and remove data on an error right before it is sent to bugsnag. The actions here will be applied to *all* errors, handled and unhandled.
beforeSend: function (report) {
if (report.errorClass === 'Error' && report.severity === 'info') {
report.errorClass = report.errorMessage
}
// note that if you return false from the beforeSend, this will cancel the entire error report.
},
// add any custom attributes relevant to your app. Note that metadata can be added here, in a specific notify (example bleow) or in a beforeSend.
metaData: {company: {
name: 'Hogwarts School of Witchcraft and Wizardry'
}
},
// N.B. our notifer automatically creates a metadata tab called "Angular" and populates it with component and context details.
// attached any user data you'd like to report.
user: {
name: 'Katherine Johnson',
email: 'kj@nasa.gov',
id: '0112358'
},
});
// review app.component.ts to see examples of how this client can interact with your code.
// See our documentation for futher options and examples https://docs.bugsnag.com/
export default bugsnagClient;