How to use the @sentry/types.Severity.fromString function in @sentry/types

To help you get started, we’ve selected a few @sentry/types 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 / browser / src / integrations / instrumenthandlers.ts View on Github external
function consoleBreadcrumb(handlerData: { [key: string]: any }): void {
  const breadcrumb = {
    category: 'console',
    data: {
      extra: {
        arguments: normalize(handlerData.args, 3),
      },
      logger: 'console',
    },
    level: Severity.fromString(handlerData.level),
    message: safeJoin(handlerData.args, ' '),
  };

  if (handlerData.level === 'assert') {
    if (handlerData.args[0] === false) {
      breadcrumb.message = `Assertion failed: ${safeJoin(handlerData.args.slice(1), ' ') || 'console.assert'}`;
      breadcrumb.data.extra.arguments = normalize(handlerData.args.slice(1), 3);
    } else {
      // Don't capture a breadcrumb for passed assertions
      return;
    }
  }

  getCurrentHub().addBreadcrumb(breadcrumb, {
    input: handlerData.args,
    level: handlerData.level,
github getsentry / sentry-javascript / packages / browser / src / integrations / instrumenthandlers.ts View on Github external
function addSentryBreadcrumb(serializedData: string): void {
  // There's always something that can go wrong with deserialization...
  try {
    const event = JSON.parse(serializedData);
    getCurrentHub().addBreadcrumb(
      {
        category: 'sentry',
        event_id: event.event_id,
        level: event.level || Severity.fromString('error'),
        message: getEventDescription(event),
      },
      {
        event,
      },
    );
  } catch (_oO) {
    logger.error('Error while adding sentry type breadcrumb');
  }
}
github getsentry / sentry-javascript / packages / integrations / src / captureconsole.ts View on Github external
hub.withScope(scope => {
            scope.setLevel(Severity.fromString(level));
            scope.setExtra('arguments', normalize(args, 3));
            scope.addEventProcessor(event => {
              event.logger = 'console';
              return event;
            });

            let message = safeJoin(args, ' ');
            if (level === 'assert') {
              if (args[0] === false) {
                message = `Assertion failed: ${safeJoin(args.slice(1), ' ') || 'console.assert'}`;
                scope.setExtra('arguments', normalize(args.slice(1), 3));
                hub.captureMessage(message);
              }
            } else {
              hub.captureMessage(message);
            }
github opf / openproject / frontend / src / app / sentry / sentry-reporter.ts View on Github external
this.client.withScope((scope:Scope) => {
      this.setupContext(scope);
      this.client.captureMessage(msg, Severity.fromString(severity));
    });
  }