mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-12-28 11:24:11 +08:00
Easier error logger
This commit is contained in:
parent
9c04a40782
commit
e2289ac204
2 changed files with 11 additions and 9 deletions
|
@ -61,7 +61,6 @@ const setupErrorLogger = (args = {}) => {
|
|||
inDevMode: args.devMode,
|
||||
resourcePath: args.resourcePath,
|
||||
});
|
||||
errorLogger.startCrashReporter();
|
||||
process.on('uncaughtException', errorLogger.reportError);
|
||||
process.on('unhandledRejection', errorLogger.reportError);
|
||||
return errorLogger;
|
||||
|
|
|
@ -10,7 +10,6 @@ if (process.type === 'renderer') {
|
|||
}
|
||||
|
||||
var appVersion = app.getVersion();
|
||||
var crashReporter = require('electron').crashReporter;
|
||||
var RavenErrorReporter = require('./error-logger-extensions/raven-error-reporter');
|
||||
|
||||
// A globally available ErrorLogger that can report errors to various
|
||||
|
@ -31,11 +30,12 @@ var RavenErrorReporter = require('./error-logger-extensions/raven-error-reporter
|
|||
module.exports = ErrorLogger = (function () {
|
||||
function ErrorLogger(args) {
|
||||
this.reportError = this.reportError.bind(this);
|
||||
this.startCrashReporter = this.startCrashReporter.bind(this);
|
||||
this.inSpecMode = args.inSpecMode;
|
||||
this.inDevMode = args.inDevMode;
|
||||
this.resourcePath = args.resourcePath;
|
||||
|
||||
this._startCrashReporter();
|
||||
|
||||
this._extendErrorObject();
|
||||
|
||||
this._extendNativeConsole();
|
||||
|
@ -100,8 +100,15 @@ module.exports = ErrorLogger = (function () {
|
|||
console.error(error, extra);
|
||||
};
|
||||
|
||||
ErrorLogger.prototype.startCrashReporter = function () {
|
||||
crashReporter.start({
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
////////////////////////// PRIVATE METHODS //////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
ErrorLogger.prototype._startCrashReporter = function (args) {
|
||||
if (process.type === 'renderer') {
|
||||
return;
|
||||
}
|
||||
require('electron').crashReporter.start({
|
||||
productName: 'Mailspring',
|
||||
companyName: 'Mailspring',
|
||||
submitURL: `https://id.getmailspring.com/report-crash?ver=${appVersion}&platform=${process.platform}`,
|
||||
|
@ -114,10 +121,6 @@ module.exports = ErrorLogger = (function () {
|
|||
})
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
////////////////////////// PRIVATE METHODS //////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
ErrorLogger.prototype._extendNativeConsole = function (args) {
|
||||
console.debug = this._consoleDebug.bind(this);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue