How to use the raygun.Client function in raygun

To help you get started, we’ve selected a few raygun 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 microsoft / TouchDevelop / backend / src / raygun.ts View on Github external
export async function initAsync(options_: IOptions = {}) : Promise
{
    assert(logger == null, "double initialization");
    logger = td.createLogger("raygun");
    if (!options_.apiKey) {
        options_.apiKey = td.serverSetting("RAYGUN_API_KEY", false);
    }
    if (options_.saveReport != null) {
        pendingReports = [];
        /* async */ saveReportLoopAsync(options_);
    }

    var opt = options_;
    var raygunClient = new raygun.Client().init({ apiKey: opt.apiKey });
    var util = require('util');
    if(opt.version) raygunClient.setVersion(opt.version);
    td.App.addTransport({
      id: "raygun",
      log : function(level, category, message, meta) {
        // "crash" messages already reported below
        if (level <= 3 && category != "crash") {
          try { throw new Error(category + ": " + message); }
          catch(err) {  raygunClient.send(err, meta); }
        }
      },
      logException : function(err, meta) {
        logger.debug("sending crash: " + err.message);
        var req = err.tdNodeRequest
        if (pendingReports) {
            var js = mkBugReport(err, "custom")
github vpdb / server / src / app / common / middleware / error.handler.middleware.ts View on Github external
import { IncomingMessage } from 'http';
import { ApiError, ApiValidationError } from '../api.error';
import { gitInfo } from '../gitinfo';
import { logger } from '../logger';
import { config } from '../settings';
import { Context } from '../typings/context';

const appVersion = require('../../../../package.json').version;

// initialize raygun
let raygunClient: any = null;
/* istanbul ignore if: no crash reporters when testing */
if (config.vpdb.services.raygun.enabled) {
	logger.info(null, '[koaErrorHandler] Setting up Raygun...');
	const raygun = require('raygun');
	raygunClient = new raygun.Client().init({ apiKey: config.vpdb.services.raygun.apiKey });
	raygunClient.setVersion(appVersion.substr(1));
}

// initialize rollbar
let rollbar: any = null;
/* istanbul ignore if: no crash reporters when testing */
if (config.vpdb.services.rollbar.enabled) {
	const Rollbar = require('rollbar');
	rollbar = new Rollbar({
		accessToken: config.vpdb.services.rollbar.apiKey,
		captureUncaught: true,
		captureUnhandledRejections: true,
		environment: config.vpdb.services.rollbar.environment,
		codeVersion: gitInfo.hasInfo() ? gitInfo.getLastCommit().SHA : appVersion,
		captureEmail: true,
		captureUsername: true,
github vpdb / server / app.js View on Github external
// override standard promises
Promise = require('bluebird');
mongoose.Promise = Promise;

const settings = require('./src/modules/settings');
const serverDomain = domain.create();
let raygunClient = null;

// setup logger
require('./src/logging').init();

// setup raygun error handling
if (config && config.vpdb.services && config.vpdb.services.raygun && config.vpdb.services.raygun.enabled) {
	const raygun = require('raygun');
	const pkg = require('./package');
	raygunClient = new raygun.Client().init({ apiKey: config.vpdb.services.raygun.apiKey });
	raygunClient.setVersion(pkg.version);
	logger.info('[logging] Raygun crash logging enabled with API key %s', config.vpdb.services.raygun.apiKey);
	serverDomain.on('error', function(err){
		logger.info('[logging] Sending error to Raygun...');
		raygunClient.send(err, {}, function() {
			process.exit(1);
		});
	});
}

// validate settings before continueing
if (!settings.validate()) {
	logger.error('[app] Settings validation failed, aborting.');
	process.exit(1);
}
github ArkEcosystem / core / packages / core-error-tracker-raygun / src / index.ts View on Github external
async register(container: Container.IContainer, options) {
        return new raygun.Client().init(options);
    },
};
github Testlio / lambda-foundation / lib / error / raygun.js View on Github external
config: function(config) {
        let key = apiKey;

        if (config.apiKey) {
            key = config.apiKey;
        }

        if (key && isProduction) {
            RaygunClient = new Raygun.Client().init({ apiKey: key });
        } else {
            RaygunClient = {
                send: function(error, extra, cb) {
                    cb();
                }
            };
        }
    }
};
github wireapp / wire-desktop / electron / src / js / initRaygun.ts View on Github external
const initClient = () => {
  raygunClient = new raygun.Client().init({apiKey: config.RAYGUN_API_KEY});

  raygunClient.onBeforeSend((payload: any) => {
    delete payload.details.machineName;
    return payload;
  });
};
github speedtracker / speedtracker-api / lib / ErrorHandler.js View on Github external
const ErrorHandler = function () {
  if (config.get('raygunApiKey').length) {
    this.client = new Raygun.Client().init({
      apiKey: config.get('raygunApiKey')
    })
  }
}

raygun

Raygun.io package for Node, written in TypeScript

MIT
Latest version published 2 years ago

Package Health Score

57 / 100
Full package analysis

Popular raygun functions