-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsentry.ts
38 lines (32 loc) · 874 Bytes
/
sentry.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
import {getClient, init as sentryInit} from '@sentry/react-native';
const DSN = 'ADD DSN BEFORE RUNNING THE APP';
export const init = () => {
sentryInit({
dsn: DSN,
enabled: false,
sampleRate: 0.0,
tracesSampleRate: 0.0,
autoSessionTracking: false,
sendClientReports: false,
});
};
export const enableSentry = () => {
const options = getClient()?.getOptions();
if (options) {
options.enabled = true;
options.sampleRate = 1.0;
options.tracesSampleRate = 1.0;
options.autoSessionTracking = true;
options.sendClientReports = true;
}
};
export const disableSentry = () => {
const options = getClient()?.getOptions();
if (options) {
options.enabled = false;
options.sampleRate = 0.0;
options.tracesSampleRate = 0.0;
options.autoSessionTracking = false;
options.sendClientReports = false;
}
};