commit
80c760681c
@ -3,7 +3,12 @@
|
||||
module.exports = {
|
||||
|
||||
log: {
|
||||
level: 'silly'
|
||||
level: process.env.LOG_LEVEL || 'silly'
|
||||
},
|
||||
|
||||
papertrail: {
|
||||
host: process.env.PAPERTRAIL_HOST,
|
||||
port: process.env.PAPERTRAIL_PORT
|
||||
},
|
||||
|
||||
server: {
|
||||
|
4
index.js
4
index.js
@ -20,9 +20,11 @@
|
||||
const cluster = require('cluster');
|
||||
const numCPUs = require('os').cpus().length;
|
||||
const config = require('config');
|
||||
const log = require('npmlog');
|
||||
const log = require('winston');
|
||||
const papertrail = require('./src/dao/papertrail');
|
||||
|
||||
log.level = config.log.level;
|
||||
papertrail.init(config.papertrail);
|
||||
|
||||
//
|
||||
// Start worker cluster depending on number of CPUs
|
||||
|
@ -29,8 +29,9 @@
|
||||
"mongodb": "^2.2.31",
|
||||
"nodemailer": "^2.4.2",
|
||||
"nodemailer-openpgp": "^1.0.2",
|
||||
"npmlog": "^4.0.2",
|
||||
"openpgp": "^2.3.0"
|
||||
"openpgp": "^2.3.0",
|
||||
"winston": "^2.3.1",
|
||||
"winston-papertrail": "^1.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^4.1.1",
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const log = require('npmlog');
|
||||
const log = require('winston');
|
||||
const config = require('config');
|
||||
const koaBody = require('koa-body');
|
||||
const util = require('../service/util');
|
||||
@ -58,7 +58,7 @@ exports.parseBody = () => koaBody({
|
||||
|
||||
exports.logUnknownError = function(error, ctx) {
|
||||
if (error.status) {
|
||||
log.verbose('middleware', 'Request faild: %s, %s', error.status, error.message);
|
||||
log.verbose('middleware', `Request failed: ${error.status} ${error.message}`);
|
||||
} else {
|
||||
log.error('middleware', 'Unknown error', error, ctx);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const log = require('npmlog');
|
||||
const log = require('winston');
|
||||
const MongoClient = require('mongodb').MongoClient;
|
||||
|
||||
/**
|
||||
|
36
src/dao/papertrail.js
Normal file
36
src/dao/papertrail.js
Normal file
@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Mailvelope - secure email with OpenPGP encryption for Webmail
|
||||
* Copyright (C) 2016 Mailvelope GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const log = require('winston');
|
||||
const config = require('config');
|
||||
require('winston-papertrail');
|
||||
|
||||
log.exitOnError = false;
|
||||
log.level = config.log.level;
|
||||
|
||||
exports.init = function({host, port}) {
|
||||
if (!host || !port) {
|
||||
return;
|
||||
}
|
||||
log.add(log.transports.Papertrail, {
|
||||
level: config.log.level,
|
||||
host,
|
||||
port
|
||||
});
|
||||
};
|
@ -17,7 +17,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const log = require('npmlog');
|
||||
const log = require('winston');
|
||||
const util = require('../service/util');
|
||||
const nodemailer = require('nodemailer');
|
||||
const openpgpEncrypt = require('nodemailer-openpgp').openpgpEncrypt;
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const log = require('npmlog');
|
||||
const log = require('winston');
|
||||
const config = require('config');
|
||||
const init = require('./app');
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const log = require('npmlog');
|
||||
const log = require('winston');
|
||||
const util = require('./util');
|
||||
const openpgp = require('openpgp');
|
||||
const addressparser = require('addressparser');
|
||||
|
@ -5,7 +5,7 @@ const Mongo = require('../../src/dao/mongo');
|
||||
const nodemailer = require('nodemailer');
|
||||
const config = require('config');
|
||||
const fs = require('fs');
|
||||
const log = require('npmlog');
|
||||
const log = require('winston');
|
||||
|
||||
describe('Koa App (HTTP Server) Integration Tests', function() {
|
||||
this.timeout(20000);
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const log = require('npmlog');
|
||||
const log = require('winston');
|
||||
const config = require('config');
|
||||
const Mongo = require('../../src/dao/mongo');
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const log = require('npmlog');
|
||||
const log = require('winston');
|
||||
const config = require('config');
|
||||
const nodemailer = require('nodemailer');
|
||||
const Email = require('../../src/email/email');
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const log = require('npmlog');
|
||||
const log = require('winston');
|
||||
const Email = require('../../src/email/email');
|
||||
const nodemailer = require('nodemailer');
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const log = require('npmlog');
|
||||
const log = require('winston');
|
||||
const openpgp = require('openpgp');
|
||||
const PGP = require('../../src/service/pgp');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user