UNPKG

@sentry/integrations

Version:
63 lines (55 loc) 1.47 kB
Object.defineProperty(exports, '__esModule', { value: true }); const utils = require('@sentry/utils'); /** * Integration to debug sent Sentry events. * This integration should not be used in production */ class Debug { /** * @inheritDoc */ static __initStatic() {this.id = 'Debug';} /** * @inheritDoc */ __init() {this.name = Debug.id;} constructor(options) {;Debug.prototype.__init.call(this); this._options = { debugger: false, stringify: false, ...options, }; } /** * @inheritDoc */ setupOnce(addGlobalEventProcessor, getCurrentHub) { addGlobalEventProcessor((event, hint) => { const self = getCurrentHub().getIntegration(Debug); if (self) { if (self._options.debugger) { // eslint-disable-next-line no-debugger debugger; } /* eslint-disable no-console */ utils.consoleSandbox(() => { if (self._options.stringify) { console.log(JSON.stringify(event, null, 2)); if (Object.keys(hint).length) { console.log(JSON.stringify(hint, null, 2)); } } else { console.log(event); if (Object.keys(hint).length) { console.log(hint); } } }); /* eslint-enable no-console */ } return event; }); } } Debug.__initStatic(); exports.Debug = Debug; //# sourceMappingURL=debug.js.map