mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
update sentry
This commit is contained in:
parent
b0d0b5ed4c
commit
32bd714d43
@ -20,19 +20,8 @@ const writeMessage = (messageType, message) => {
|
||||
consoleLog(chalk.yellow(` ${messageType} ${line}`));
|
||||
consoleLog(' ');
|
||||
|
||||
|
||||
let logLine = [];
|
||||
words.forEach(word => {
|
||||
logLine.push(word);
|
||||
const logLineString = logLine.join(' ');
|
||||
if (logLineString.length > 50) {
|
||||
consoleLog(chalk.yellow(` ${logLineString}`));
|
||||
logLine = [];
|
||||
}
|
||||
});
|
||||
|
||||
if (logLine.length !== 0) {
|
||||
consoleLog(chalk.yellow(` ${logLine.join(' ')}`));
|
||||
if (message) {
|
||||
consoleLog(chalk.white(` ${message}`));
|
||||
}
|
||||
|
||||
consoleLog(' ');
|
||||
@ -53,11 +42,6 @@ module.exports.SError = module.exports.ServerlessError;
|
||||
|
||||
module.exports.logError = (e) => {
|
||||
try {
|
||||
// console.log(e)
|
||||
// throw errors to sentry
|
||||
// if (!fileExistsSync(statsDisabledFilePath)) { // ignore if tracking disabled
|
||||
errorReporter.captureException(e);
|
||||
// }
|
||||
const errorType = e.name.replace(/([A-Z])/g, ' $1');
|
||||
|
||||
writeMessage(errorType, e.message);
|
||||
@ -79,6 +63,10 @@ module.exports.logError = (e) => {
|
||||
consoleLog(' ');
|
||||
}
|
||||
|
||||
const platform = chalk.white(process.platform);
|
||||
const nodeVersion = chalk.white(process.version.replace(/^[v|V]/, ''));
|
||||
const slsVersion = chalk.white(version);
|
||||
|
||||
consoleLog(chalk.yellow(' Get Support --------------------------------------------'));
|
||||
consoleLog(`${chalk.yellow(' Docs: ')}${chalk.white('docs.serverless.com')}`);
|
||||
consoleLog(`${chalk.yellow(' Bugs: ')}${chalk
|
||||
@ -89,14 +77,18 @@ module.exports.logError = (e) => {
|
||||
|
||||
consoleLog(' ');
|
||||
consoleLog(chalk.yellow(' Your Environment Information -----------------------------'));
|
||||
consoleLog(chalk.yellow(` OS: ${process.platform}`));
|
||||
consoleLog(chalk.yellow(` Node Version: ${process.version.replace(/^[v|V]/, '')}`));
|
||||
consoleLog(chalk.yellow(` Serverless Version: ${version}`));
|
||||
consoleLog(chalk.yellow(` OS: ${platform}`));
|
||||
consoleLog(chalk.yellow(` Node Version: ${nodeVersion}`));
|
||||
consoleLog(chalk.yellow(` Serverless Version: ${slsVersion}`));
|
||||
consoleLog(' ');
|
||||
|
||||
setTimeout(function report() { // eslint-disable-line
|
||||
errorReporter.captureException(e);
|
||||
}, 0);
|
||||
// Failure exit
|
||||
process.exit(1);
|
||||
// process.exit(1);
|
||||
} catch (errorHandlingError) {
|
||||
console.log('catch hit')
|
||||
throw new Error(e);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1,26 +1,33 @@
|
||||
const raven = require('raven');
|
||||
const ci = require('ci-info');
|
||||
const isTrackingDisabled = require('./isTrackingDisabled');
|
||||
const getFrameworkId = require('./getFrameworkId');
|
||||
const pkg = require('./../../package.json');
|
||||
|
||||
const noSentry = process.env.SERVERLESS_DISABLE_DEBUG === 'false';
|
||||
const DSN = 'https://cbb3655b343a49ee9a18494d0dd171a7:4b9ef9a2c5eb40379f30b5e6808d3814@sentry.io/165477';
|
||||
const SLS_DISABLE_ERROR_TRACKING = process.env.SLS_DISABLE_ERROR_TRACKING === 'true';
|
||||
|
||||
function initializeErrorReporter() {
|
||||
// if (!fileExistsSync(statsDisabledFilePath)) {
|
||||
// return false
|
||||
// }
|
||||
// exit if tracking disabled or inside CI system
|
||||
if (SLS_DISABLE_ERROR_TRACKING || isTrackingDisabled() || ci.isCI) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// initialize Error tracking
|
||||
raven.config(noSentry ? false : DSN, {
|
||||
raven.config(DSN, {
|
||||
environment: 'production',
|
||||
autoBreadcrumbs: true,
|
||||
release: pkg.version,
|
||||
extra: {
|
||||
frameworkId: getFrameworkId(),
|
||||
},
|
||||
});
|
||||
|
||||
raven.disableConsoleAlerts();
|
||||
|
||||
if (!noSentry) {
|
||||
raven.install();
|
||||
}
|
||||
raven.install();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports.initializeErrorReporter = initializeErrorReporter;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user