Use winston instead of npmlog

This commit is contained in:
Tankred Hase 2017-08-18 18:01:34 +08:00
parent a156f05002
commit 35dbc08015
13 changed files with 15 additions and 15 deletions

View File

@ -3,7 +3,7 @@
module.exports = {
log: {
level: 'silly'
level: process.env.LOG_LEVEL || 'silly'
},
server: {

View File

@ -20,7 +20,7 @@
const cluster = require('cluster');
const numCPUs = require('os').cpus().length;
const config = require('config');
const log = require('npmlog');
const log = require('winston');
log.level = config.log.level;

View File

@ -29,8 +29,8 @@
"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"
},
"devDependencies": {
"chai": "^4.1.1",

View File

@ -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);
}

View File

@ -17,7 +17,7 @@
'use strict';
const log = require('npmlog');
const log = require('winston');
const MongoClient = require('mongodb').MongoClient;
/**

View File

@ -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;

View File

@ -17,7 +17,7 @@
'use strict';
const log = require('npmlog');
const log = require('winston');
const config = require('config');
const init = require('./app');

View File

@ -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');

View File

@ -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);

View File

@ -1,6 +1,6 @@
'use strict';
const log = require('npmlog');
const log = require('winston');
const config = require('config');
const Mongo = require('../../src/dao/mongo');

View File

@ -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');

View File

@ -1,6 +1,6 @@
'use strict';
const log = require('npmlog');
const log = require('winston');
const Email = require('../../src/email/email');
const nodemailer = require('nodemailer');

View File

@ -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');