remove bugsnag

This commit is contained in:
andris9 2018-12-27 15:49:34 +02:00
parent ebab1f7b22
commit c3f2b8f3d3
3 changed files with 69 additions and 109 deletions

View file

@ -22,10 +22,6 @@ maxForwards=2000
# If usernames are not email addresses then use this domain as hostname part # If usernames are not email addresses then use this domain as hostname part
#emailDomain="mydomain.info" #emailDomain="mydomain.info"
# Bugsnag API key
# If set then reports errors to Bugsnag
bugsnagCode=""
[dbs] [dbs]
# @include "dbs.toml" # @include "dbs.toml"

View file

@ -6,17 +6,12 @@ const Gelf = require('gelf');
const os = require('os'); const os = require('os');
const util = require('util'); const util = require('util');
let bugsnag;
let loggelf; let loggelf;
let component; let component;
let hostname; let hostname;
module.exports.gelf = {}; module.exports.gelf = {};
if (config.bugsnagCode) {
bugsnag = require('bugsnag');
bugsnag.register(config.bugsnagCode);
} else {
let gelfconf = (config && config.log && config.log.gelf) || {}; let gelfconf = (config && config.log && config.log.gelf) || {};
component = gelfconf.component || 'wildduck'; component = gelfconf.component || 'wildduck';
@ -89,14 +84,9 @@ if (config.bugsnagCode) {
} }
} }
}; };
}
module.exports.notify = (...args) => { module.exports.notify = (...args) => {
if (bugsnag) {
bugsnag.notify(...args);
} else {
loggelf(...args); loggelf(...args);
}
}; };
module.exports.notifyConnection = (connection, ...args) => { module.exports.notifyConnection = (connection, ...args) => {
@ -120,30 +110,7 @@ module.exports.notifyConnection = (connection, ...args) => {
}); });
args[1] = metaData; args[1] = metaData;
if (bugsnag) {
bugsnag.notify(...args);
} else {
loggelf(...args); loggelf(...args);
}
};
module.exports.intercept = (...args) => {
if (bugsnag) {
return bugsnag.intercept(...args);
}
let cb;
if (args.length) {
cb = args[args.length - 1];
if (typeof cb === 'function') {
args[args.length - 1] = function(...returnArgs) {
if (returnArgs.length > 1 && returnArgs[0]) {
console.error(returnArgs[0]);
}
return cb(...returnArgs);
};
}
}
}; };
module.exports.setGelf = gelf => { module.exports.setGelf = gelf => {

View file

@ -4,7 +4,6 @@
"description": "IMAP/POP3 server built with Node.js and MongoDB", "description": "IMAP/POP3 server built with Node.js and MongoDB",
"main": "server.js", "main": "server.js",
"scripts": { "scripts": {
"toc": "markdown-toc -i docs/api.md",
"test": "mongo --eval 'db.dropDatabase()' wildduck-test && redis-cli -n 13 flushdb && NODE_ENV=test grunt", "test": "mongo --eval 'db.dropDatabase()' wildduck-test && redis-cli -n 13 flushdb && NODE_ENV=test grunt",
"apidoc": "apidoc -i lib/api/ -o docs/", "apidoc": "apidoc -i lib/api/ -o docs/",
"show": "NODE_CONFIG_ONLY=true node server.js" "show": "NODE_CONFIG_ONLY=true node server.js"
@ -31,7 +30,6 @@
"grunt-wait": "0.3.0", "grunt-wait": "0.3.0",
"icedfrisby": "1.5.0", "icedfrisby": "1.5.0",
"mailparser": "2.4.3", "mailparser": "2.4.3",
"markdown-toc": "1.2.0",
"mocha": "5.2.0", "mocha": "5.2.0",
"request": "2.88.0" "request": "2.88.0"
}, },
@ -40,7 +38,6 @@
"accesscontrol": "2.2.1", "accesscontrol": "2.2.1",
"base32.js": "0.1.0", "base32.js": "0.1.0",
"bcryptjs": "2.4.3", "bcryptjs": "2.4.3",
"bugsnag": "2.4.3",
"gelf": "2.0.1", "gelf": "2.0.1",
"generate-password": "1.4.1", "generate-password": "1.4.1",
"he": "1.2.0", "he": "1.2.0",