Commit 81ae25d9 by mawei

Find log issue

parent 05cf879a
...@@ -9,7 +9,7 @@ class DI { ...@@ -9,7 +9,7 @@ class DI {
} }
static getLogger() { static getLogger() {
const level = process.env.NODE_LOG_LEVEL || 'error'; const level = process.env.NODE_LOG_LEVEL || 'info';
log4js.configure({ log4js.configure({
appenders: { appenders: {
console: { type: 'console' }, console: { type: 'console' },
......
...@@ -11,19 +11,38 @@ const config = require('config'); ...@@ -11,19 +11,38 @@ const config = require('config');
async function t () { async function t () {
return 't'; return 't';
} }
const DI = require('./lib/DI');
const logger = DI.getLogger();
// new Buffer('hnmz147852.').toString('base64') // new Buffer('hnmz147852.').toString('base64')
// new Buffer('Q2hlY2hlbmcyMzUj', 'base64').toString(); // new Buffer('Q2hlY2hlbmcyMzUj', 'base64').toString();
let i = 0;
async function test (l) { async function test (l) {
i += 1;
await Promise.delay(l*1000).then(async function() { await Promise.delay(l*1000).then(async function() {
console.log('过了' + l + '秒'); logger.info('过了' + l + '秒');
console.log((new Date()).toLocaleString()); logger.info((new Date()).toLocaleString());
console.log('======================================='); logger.info('=======================================');
if (i < 8) {
test(1);
} else {
return true;
}
}); });
} }
(async () => { (async () => {
await test(1).then(async () => {
await DI.shutdownLogger(async () => {
console.log('牛逼啊');
});
});
return;
const mt = await t(); const mt = await t();
console.log(mt); console.log(mt);
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment