How to use the @sentry/utils.logger.log function in @sentry/utils

To help you get started, we’ve selected a few @sentry/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github getsentry / sentry-javascript / packages / core / src / baseclient.ts View on Github external
if (isInternalException || !beforeSend) {
              this._getBackend().sendEvent(finalEvent);
              resolve(finalEvent);
              return;
            }

            const beforeSendResult = beforeSend(prepared, hint);
            if ((typeof beforeSendResult as any) === 'undefined') {
              logger.error('`beforeSend` method has to return `null` or a valid event.');
            } else if (isThenable(beforeSendResult)) {
              this._handleAsyncBeforeSend(beforeSendResult as PromiseLike, resolve, reject);
            } else {
              finalEvent = beforeSendResult as Event | null;

              if (finalEvent === null) {
                logger.log('`beforeSend` returned `null`, will not send event.');
                resolve(null);
                return;
              }

              // From here on we are really async
              this._getBackend().sendEvent(finalEvent);
              resolve(finalEvent);
            }
          } catch (exception) {
            this.captureException(exception, {
              data: {
                __sentry__: true,
              },
              originalException: exception as Error,
            });
            reject('`beforeSend` threw an error, will not send event.');
github getsentry / sentry-react-native / src / js / integrations / reactnativeerrorhandlers.ts View on Github external
ErrorUtils.setGlobalHandler((error: any, isFatal?: boolean) => {
        // We want to handle fatals, but only in production mode.
        const shouldHandleFatal = isFatal && !global.__DEV__;
        if (shouldHandleFatal) {
          if (handlingFatal) {
            logger.log(
              "Encountered multiple fatals in a row. The latest:",
              error
            );
            return;
          }
          handlingFatal = true;
        }

        getCurrentHub().withScope(scope => {
          if (isFatal) {
            scope.setLevel(Severity.Fatal);
          }
          getCurrentHub().captureException(error, {
            originalException: error
          });
        });
github getsentry / sentry-javascript / packages / browser / src / integrations / globalhandlers.ts View on Github external
public setupOnce(): void {
    Error.stackTraceLimit = 50;

    if (this._options.onerror) {
      logger.log('Global Handler attached: onerror');
      this._installGlobalOnErrorHandler();
    }

    if (this._options.onunhandledrejection) {
      logger.log('Global Handler attached: onunhandledrejection');
      this._installGlobalOnUnhandledRejectionHandler();
    }
  }
github getsentry / sentry-javascript / packages / core / src / integration.ts View on Github external
export function setupIntegration(integration: Integration): void {
  if (installedIntegrations.indexOf(integration.name) !== -1) {
    return;
  }
  integration.setupOnce(addGlobalEventProcessor, getCurrentHub);
  installedIntegrations.push(integration.name);
  logger.log(`Integration installed: ${integration.name}`);
}
github getsentry / sentry-javascript / packages / browser / src / integrations / globalhandlers.ts View on Github external
public setupOnce(): void {
    Error.stackTraceLimit = 50;

    if (this._options.onerror) {
      logger.log('Global Handler attached: onerror');
      this._installGlobalOnErrorHandler();
    }

    if (this._options.onunhandledrejection) {
      logger.log('Global Handler attached: onunhandledrejection');
      this._installGlobalOnUnhandledRejectionHandler();
    }
  }