How to use the @sentry/node.Severity function in @sentry/node

To help you get started, we’ve selected a few @sentry/node 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 splash-cli / splash-cli / src / client.js View on Github external
}
	});

	const [command, ...subCommands] = input;
	const options = {};

	// Parse commands
	for (let i = 0; i < subCommands.length; i += 1) {
		options[subCommands[i]] = subCommands[i];
	}

	if (flags.report) {
		console.clear();
		console.log(chalk`{yellow {bold ERROR REPORTING}}`);
		console.log();
		const event_id = Sentry.captureMessage(`MESSAGE ${randomString(6)}`, Sentry.Severity.Info);
		await SentryAPIClient.shared.userFeedBack(null, event_id);
		process.exit(0);
	}

	if (flags.quiet) {
		const emptyFunction = () => null;

		console.log = console.info = emptyFunction;

		if (spinner.fail) {
			spinner.fail = emptyFunction;
		}

		if (spinner.start) {
			spinner.start = emptyFunction;
		}
github Lightmatter / generic-django-conf / {{cookiecutter.repo_name}} / src / pages / _document.jsx View on Github external
render() {
        Sentry.addBreadcrumb({
            category: fileLabel,
            message: `Preparing document (${
                isServer() ? 'server' : 'browser'
            })`,
            level: Sentry.Severity.Debug,
        });

        return (
            
                
                    {/* PWA primary color */}
github splash-cli / splash-cli / src / client.js View on Github external
dns.lookup('api.unsplash.com', (error) => {
		if (error && error.code === 'ENOTFOUND') {
			Sentry.captureMessage('No Internet Connection', Sentry.Severity.Warning);
			console.error(chalk.red('\n Please check your internet connection.\n'));
			process.exit(1);
		}
	});
github Ionaru / EVIE / server / src / index.ts View on Github external
process.on('unhandledRejection', (reason, p): void => {
        Sentry.captureMessage(`Unhandled Rejection at: Promise ${p}, reason: ${reason}`, Sentry.Severity.Error);
    });
github meetalva / alva / packages / core / src / adapters / electron-adapter / electron-adapter.ts View on Github external
Sentry.withScope(scope => {
				scope.setTag('report-type', 'user-report');
				scope.setLevel(Sentry.Severity.Error);
				scope.setExtra('report', JSON.stringify(m.payload));
				Sentry.captureMessage(`User report: ${message}`);
			});
		});
github nusmodifications / nusmods / scrapers / nus-v2 / src / services / logger / SentryStream.ts View on Github external
function getSentryLevel(record: BunyanRecord): Sentry.Severity {
  const { level } = record;

  if (level >= 60) return Sentry.Severity.Critical;
  if (level >= 50) return Sentry.Severity.Error;
  if (level === 40) return Sentry.Severity.Warning;

  return Sentry.Severity.Info;
}
github wix-incubator / corvid / packages / corvid-local-logger / src / sentry / SentryTransport.js View on Github external
const Sentry = require("@sentry/node");
const Transport = require("winston-transport");
const isError_ = require("lodash/isError");
const UserError = require("../UserError");

const WINSTON_TO_SENTRY_LEVEL = {
  error: Sentry.Severity.Error,
  warn: Sentry.Severity.Warning,
  info: Sentry.Severity.Info,
  verbose: Sentry.Severity.Info,
  debug: Sentry.Severity.Debug
};

const convertLevel = ({ level, ...rest }) =>
  level ? { level: WINSTON_TO_SENTRY_LEVEL[level], ...rest } : rest;

class SentryTransport extends Transport {
  constructor(opts) {
    super(opts);
    this._sentry = opts.sentry;
    this._sillyLogs = [];
  }

  _captureException(error, { level = "error", extra }) {
    this._sentry.withScope(scope => {
      scope.setLevel(WINSTON_TO_SENTRY_LEVEL[level]);
github meetalva / alva / packages / core / src / adapters / electron-adapter / electron-adapter.ts View on Github external
Sentry.withScope(scope => {
				scope.setTag('report-type', 'csp');
				scope.setLevel(Sentry.Severity.Error);
				scope.setExtra('referrer', (m.payload as any).referrer);
				scope.setExtra('violated-directive', (m.payload as any)['violated-directive']);
				scope.setExtra('blocked-uri', (m.payload as any)['blocked-uri']);
				scope.setExtra('source-file', (m.payload as any)['source-file']);
				scope.setExtra('report', JSON.stringify(m.payload));
				Sentry.captureMessage(`CSP violation: ${(m.payload as any)['blocked-uri']}`);
			});
		});
github Christilut / node-modern-boilerplate / config / sentry.ts View on Github external
Sentry.withScope(scope => {
    for (const key in extra) {
      scope.setExtra(key, extra[key])
    }

    scope.setLevel(Sentry.Severity.Error)
    Sentry.captureException(err)
  })
}