1 | import { getCurrentHub } from '@sentry/hub';
|
2 | import { logger } from '@sentry/utils';
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | function initAndBind(
|
14 | clientClass,
|
15 | options,
|
16 | ) {
|
17 | if (options.debug === true) {
|
18 | if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {
|
19 | logger.enable();
|
20 | } else {
|
21 |
|
22 | console.warn('[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.');
|
23 | }
|
24 | }
|
25 | var hub = getCurrentHub();
|
26 | var scope = hub.getScope();
|
27 | if (scope) {
|
28 | scope.update(options.initialScope);
|
29 | }
|
30 |
|
31 | var client = new clientClass(options);
|
32 | hub.bindClient(client);
|
33 | }
|
34 |
|
35 | export { initAndBind };
|
36 |
|