UNPKG

@sentry/integrations

Version:
64 lines (54 loc) 1.44 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 */ constructor(options) { this.name = Debug.id; this._options = { debugger: false, stringify: false, ...options, }; } /** * @inheritDoc */ setupOnce(_addGlobalEventProcessor, getCurrentHub) { const client = getCurrentHub().getClient(); if (client && client.on) { client.on('beforeSendEvent', (event, hint) => { if (this._options.debugger) { // eslint-disable-next-line no-debugger debugger; } /* eslint-disable no-console */ utils.consoleSandbox(() => { if (this._options.stringify) { console.log(JSON.stringify(event, null, 2)); if (hint && Object.keys(hint).length) { console.log(JSON.stringify(hint, null, 2)); } } else { console.log(event); if (hint && Object.keys(hint).length) { console.log(hint); } } }); /* eslint-enable no-console */ }); } } } Debug.__initStatic(); exports.Debug = Debug; //# sourceMappingURL=debug.js.map