blob: 5cb2237a415443ffb348578dd1822847f0742140 (
plain)
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
|
import { logger } from '@sentry/utils';
import { getCurrentHub } from './hub.js';
/** A class object that can instantiate Client objects. */
/**
* Internal function to create a new SDK client instance. The client is
* installed and then bound to the current scope.
*
* @param clientClass The client class to instantiate.
* @param options Options to pass to the client.
*/
function initAndBind(
clientClass,
options,
) {
if (options.debug === true) {
if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {
logger.enable();
} else {
// use `console.warn` rather than `logger.warn` since by non-debug bundles have all `logger.x` statements stripped
// eslint-disable-next-line no-console
console.warn('[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.');
}
}
const hub = getCurrentHub();
const scope = hub.getScope();
scope.update(options.initialScope);
const client = new clientClass(options);
hub.bindClient(client);
}
export { initAndBind };
//# sourceMappingURL=sdk.js.map
|