Commit ec631b16 by 马玮

Fix log mark

parent 7ae3c13f
...@@ -26,21 +26,15 @@ class DI { ...@@ -26,21 +26,15 @@ class DI {
console.log(process.cwd()); console.log(process.cwd());
} }
static setLogMark(category, context) { static getLogger() {
this.LOG_MARK = this.LOG_MARK || {};
this.LOG_MARK[category] = context;
}
static getLogger(category = 'SPIDER') {
this.LOG_MARK = this.LOG_MARK || {};
const level = process.env.LOG_LEVEL || 'info'; const level = process.env.LOG_LEVEL || 'info';
const appenders = (process.env.LOG_TYPE ? process.env.LOG_TYPE.split(',') : null) || [ 'console', 'carspider' ]; const appenders = (process.env.LOG_TYPE ? process.env.LOG_TYPE.split(',') : null) || [ 'console', 'carspider' ];
const layout = { const layout = {
type: 'pattern', type: 'pattern',
pattern: '%[[%d] [%p] [PID:%z] [%x{mark}%]] %m', pattern: '%[[%d] [%p] [PID:%z|%x{mark}%]] %m',
tokens: { tokens: {
mark: (logEvent) => { mark: (logEvent) => {
return this.LOG_MARK[category] || 'Master'; return this.LOG_MARK || 'Main';
} }
}, },
}; };
...@@ -63,7 +57,7 @@ class DI { ...@@ -63,7 +57,7 @@ class DI {
default: { appenders: appenders, level: level } default: { appenders: appenders, level: level }
} }
}); });
return log4js.getLogger('SPIDER'); return log4js.getLogger();
} }
static shutdownLogger(cb) { static shutdownLogger(cb) {
......
...@@ -9,7 +9,7 @@ captcha.decode = async (captchaType, imageFile) => { ...@@ -9,7 +9,7 @@ captcha.decode = async (captchaType, imageFile) => {
console.info('captchaType:', captchaType); console.info('captchaType:', captchaType);
console.info('imageFile:', imageFile); console.info('imageFile:', imageFile);
const typeids = config.get('captcha.ruokuai.typeids'); const typeids = config.get('captcha.ruokuai.typeids');
typeid = typeids[captchaType]; const typeid = typeids[captchaType];
const captchaText = ruokuai.decode(typeid, imageFile); const captchaText = ruokuai.decode(typeid, imageFile);
return captchaText; return captchaText;
}; };
......
...@@ -58,7 +58,7 @@ class DealerHelper { ...@@ -58,7 +58,7 @@ class DealerHelper {
if (err) { if (err) {
reject(err); reject(err);
} else { } else {
logger.info(`accountID: ${params.accountID}, cookie保存成功`); logger.info(`cookie保存成功`);
resolve(true); resolve(true);
} }
} }
...@@ -120,7 +120,7 @@ class DealerHelper { ...@@ -120,7 +120,7 @@ class DealerHelper {
let sql; let sql;
// areaStrs.push('河南三门峡卢氏', '北京', '上海', '天津天津', '河南濮阳南乐', '河南郑州管城'); // areaStrs.push('河南三门峡卢氏', '北京', '上海', '天津天津', '河南濮阳南乐', '河南郑州管城');
logger.info(`accountID: ${params.accountID}, 待匹配城市: ${JSON.stringify(areaStrs)}`); logger.info(`待匹配城市: ${JSON.stringify(areaStrs)}`);
const getAreas = async (areaStrs, areaType) => { const getAreas = async (areaStrs, areaType) => {
// ${connection.escape(areaStrs.join())} // ${connection.escape(areaStrs.join())}
...@@ -178,7 +178,7 @@ class DealerHelper { ...@@ -178,7 +178,7 @@ class DealerHelper {
} }
if (areaStrs.length > 0) { if (areaStrs.length > 0) {
logger.info(`accountID: ${params.accountID}, 以下城市匹配失败: ${JSON.stringify(areaStrs)}`); logger.info(`以下城市匹配失败: ${JSON.stringify(areaStrs)}`);
} }
resolve(mappedAreas); resolve(mappedAreas);
...@@ -286,7 +286,7 @@ class DealerHelper { ...@@ -286,7 +286,7 @@ class DealerHelper {
} }
clues = await this.mapClues(params).catch((e) => { clues = await this.mapClues(params).catch((e) => {
logger.error(`accountID: ${params.accountID}, 线索信息匹配失败: ${e}}`); logger.error(`线索信息匹配失败: ${e}}`);
}); });
const connection = await DI.getConnection('MASTER_CRM'); const connection = await DI.getConnection('MASTER_CRM');
...@@ -314,15 +314,15 @@ class DealerHelper { ...@@ -314,15 +314,15 @@ class DealerHelper {
area: clue.customerAreaID, area: clue.customerAreaID,
createTime: clue.createdAt createTime: clue.createdAt
}); });
logger.info(`accountID: ${params.accountID}, 客户信息保存成功, customerID: ${clue.customerID}`); logger.info(`客户信息保存成功, customerID: ${clue.customerID}`);
} catch (e) { } catch (e) {
// 如果没有customerID则跳过这条线索 // 如果没有customerID则跳过这条线索
logger.error(`accountID: ${params.accountID}, 客户信息保存失败: ${e}}`); logger.error(`客户信息保存失败: ${e}}`);
continue; continue;
} }
if (!clue.intentionID) { if (!clue.intentionID) {
logger.error(`accountID: ${params.accountID}, 线索车系匹配失败: ${clue.intentionDes}`); logger.error(`线索车系匹配失败: ${clue.intentionDes}`);
continue; continue;
} }
...@@ -358,7 +358,7 @@ class DealerHelper { ...@@ -358,7 +358,7 @@ class DealerHelper {
if (results.affectedRows) { if (results.affectedRows) {
// console.log(results.insertId, results); // console.log(results.insertId, results);
logger.info(`accountID: ${params.accountID}, 线索信息保存成功, 总计: ${results.affectedRows}`); logger.info(`线索信息保存成功, 总计: ${results.affectedRows}`);
if (redisSets.length > 0) { if (redisSets.length > 0) {
await redis.multi(redisSets).exec(); await redis.multi(redisSets).exec();
...@@ -366,9 +366,9 @@ class DealerHelper { ...@@ -366,9 +366,9 @@ class DealerHelper {
try { try {
await this.saveSummary(params); await this.saveSummary(params);
logger.info(`accountID: ${params.accountID}, 线索统计保存成功`); logger.info(`线索统计保存成功`);
} catch (e) { } catch (e) {
logger.info(`accountID: ${params.accountID}, 线索统计保存失败, ${e}`); logger.info(`线索统计保存失败, ${e}`);
} }
resolve(true); resolve(true);
......
...@@ -16,15 +16,14 @@ class Base { ...@@ -16,15 +16,14 @@ class Base {
this.params = params; this.params = params;
this.loginTimes = 0; this.loginTimes = 0;
this.maxLoginTimes = 3; this.maxLoginTimes = 3;
logger.addContext('user', 'accountID: 1'); DI.LOG_MARK = `AID:${this.params.accountID}`;
this.logger = logger;
} }
async execute() { async execute() {
try { try {
await this[this.params.task](); await this[this.params.task]();
} catch (e) { } catch (e) {
logger.fatal(`accountID: ${this.params.accountID}, 系统异常: ${e}`); logger.fatal(`系统异常: ${e}`);
} }
} }
...@@ -36,27 +35,27 @@ class Base { ...@@ -36,27 +35,27 @@ class Base {
if (this.loginTimes < this.maxLoginTimes) { if (this.loginTimes < this.maxLoginTimes) {
this.loginTimes += 1; this.loginTimes += 1;
logger.info(`accountID: ${this.params.accountID}, 开始尝试登录: ${this.loginTimes}次`); logger.info(`开始尝试登录: ${this.loginTimes}次`);
try { try {
await this.tryLogin(); await this.tryLogin();
logger.info(`accountID: ${this.params.accountID}, 尝试登录成功: ${this.loginTimes}次`); logger.info(`尝试登录成功: ${this.loginTimes}次`);
return 1; return 1;
} catch (e) { } catch (e) {
logger.info(`accountID: ${this.params.accountID}, 尝试登录失败: ${this.loginTimes}次`); logger.info(`尝试登录失败: ${this.loginTimes}次`);
} }
logger.info(`accountID: ${this.params.accountID}, 开始表单登录: ${this.loginTimes}次`); logger.info(`开始表单登录: ${this.loginTimes}次`);
try { try {
await this.login(); await this.login();
logger.info(`accountID: ${this.params.accountID}, 表单登录成功: ${this.loginTimes}次`); logger.info(`表单登录成功: ${this.loginTimes}次`);
return 1; return 1;
} catch (e) { } catch (e) {
logger.info(`accountID: ${this.params.accountID}, 表单登录失败: ${this.loginTimes}次`); logger.info(`表单登录失败: ${this.loginTimes}次`);
return await this.retryLogin(); return await this.retryLogin();
} }
} else { } else {
logger.error(`accountID: ${this.params.accountID}, 触发登录失败上限: ${this.loginTimes}次`); logger.error(`触发登录失败上限: ${this.loginTimes}次`);
throw new errors.LoginError('登录失败'); throw new errors.LoginError('登录失败');
} }
} }
...@@ -65,9 +64,9 @@ class Base { ...@@ -65,9 +64,9 @@ class Base {
async updateLatestFetch() { async updateLatestFetch() {
try { try {
await DealerHelper.updateLatestFetch(this.params); await DealerHelper.updateLatestFetch(this.params);
logger.info(`accountID: ${this.params.accountID}, 抓取时间更新成功`); logger.info(`抓取时间更新成功`);
} catch (e) { } catch (e) {
logger.error(`accountID: ${this.params.accountID}, 抓取时间更新失败, ${e}`); logger.error(`抓取时间更新失败: ${e}`);
} }
} }
} }
......
...@@ -22,8 +22,6 @@ axios.defaults.withCredentials = true; ...@@ -22,8 +22,6 @@ axios.defaults.withCredentials = true;
class Autohome extends Base { class Autohome extends Base {
constructor(params) { constructor(params) {
super(params); super(params);
this.logger.error('欢迎来到王者荣耀');
return;
} }
async tryLogin() { async tryLogin() {
...@@ -37,7 +35,7 @@ class Autohome extends Base { ...@@ -37,7 +35,7 @@ class Autohome extends Base {
try { try {
oldCookies = await DealerHelper.getCookies(this.params); oldCookies = await DealerHelper.getCookies(this.params);
} catch (e) { } catch (e) {
logger.debug(`accountID: ${this.params.accountID}, 没有cookies: ${e}`); logger.debug(`没有cookies: ${e}`);
} }
if (oldCookies) { if (oldCookies) {
...@@ -66,7 +64,7 @@ class Autohome extends Base { ...@@ -66,7 +64,7 @@ class Autohome extends Base {
const params = this.params; const params = this.params;
params.cookies = newCookies; params.cookies = newCookies;
logger.debug(`accountID: ${this.params.accountID}, cookies: ${JSON.stringify(newCookies)}`); logger.debug(`cookies: ${JSON.stringify(newCookies)}`);
await DealerHelper.saveCookies(params); await DealerHelper.saveCookies(params);
return 1; return 1;
...@@ -82,7 +80,7 @@ class Autohome extends Base { ...@@ -82,7 +80,7 @@ class Autohome extends Base {
// 随机返回登录状态 // 随机返回登录状态
// return [new errors.LoginError('登录失败'), _.random(0, 1)]; // return [new errors.LoginError('登录失败'), _.random(0, 1)];
try { try {
logger.info(`accountID: ${this.params.accountID}, 开始表单登录`); logger.info(`开始表单登录`);
const username = this.params.username; const username = this.params.username;
const password = this.params.password; const password = this.params.password;
...@@ -112,7 +110,7 @@ class Autohome extends Base { ...@@ -112,7 +110,7 @@ class Autohome extends Base {
try { try {
const captchaType = config.get(this.params.website)['captchaType']; const captchaType = config.get(this.params.website)['captchaType'];
captchaText = await captcha.decodeBase64(captchaType, base64Text); captchaText = await captcha.decodeBase64(captchaType, base64Text);
logger.info(`accountID: ${this.params.accountID}, captchaText: ${captchaText}`); logger.info(`captchaText: ${captchaText}`);
} catch (e) { } catch (e) {
logger.error(e); logger.error(e);
return; return;
...@@ -148,7 +146,7 @@ class Autohome extends Base { ...@@ -148,7 +146,7 @@ class Autohome extends Base {
const params = this.params; const params = this.params;
params.cookies = cookies; params.cookies = cookies;
logger.debug(`accountID: ${this.params.accountID}, cookies: ${JSON.stringify(cookies)}`); logger.debug(`cookies: ${JSON.stringify(cookies)}`);
await DealerHelper.saveCookies(params); await DealerHelper.saveCookies(params);
} }
...@@ -173,7 +171,7 @@ class Autohome extends Base { ...@@ -173,7 +171,7 @@ class Autohome extends Base {
} catch (e) { } catch (e) {
// TODO: 需要考虑密码、验证码等因素 // TODO: 需要考虑密码、验证码等因素
// TODO: 如果抓取线索过程中cookie失效可能也需要尝试重新登录 // TODO: 如果抓取线索过程中cookie失效可能也需要尝试重新登录
logger.error(`accountID: ${this.params.accountID}, 抓取线索登录失败: ${e}`); logger.error(`抓取线索登录失败: ${e}`);
return; return;
} }
...@@ -212,10 +210,10 @@ class Autohome extends Base { ...@@ -212,10 +210,10 @@ class Autohome extends Base {
params.productId = 0; params.productId = 0;
params.assignDealerId = 0; params.assignDealerId = 0;
logger.info(`accountID: ${this.params.accountID}, 线索抓取范围: ${params.startTime} - ${params.endtime}`); logger.info(`线索抓取范围: ${params.startTime} - ${params.endtime}`);
const fetchByPage = async () => { const fetchByPage = async () => {
logger.info(`accountID: ${this.params.accountID}, 线索页面: ${params.pageIndex}`); logger.info(`线索页面: ${params.pageIndex}`);
await axios.get('http://ics.Autohome.com.cn/Dms/Order/SearchOrderList', { await axios.get('http://ics.Autohome.com.cn/Dms/Order/SearchOrderList', {
params: params, params: params,
headers:{ headers:{
...@@ -263,7 +261,7 @@ class Autohome extends Base { ...@@ -263,7 +261,7 @@ class Autohome extends Base {
_.pick(clue, 'customerPhone', 'intentionDes', 'createDate'), _.pick(clue, 'customerPhone', 'intentionDes', 'createDate'),
), true, true); ), true, true);
logger.info(`accountID: ${this.params.accountID}, hashBase: ${hashBase}`); logger.info(`hashBase: ${hashBase}`);
let flag; let flag;
if (hashKeyExist) { if (hashKeyExist) {
...@@ -275,7 +273,7 @@ class Autohome extends Base { ...@@ -275,7 +273,7 @@ class Autohome extends Base {
clues.push(clue); clues.push(clue);
} }
logger.info(`accountID: ${this.params.accountID}, ${flag}线索: ${JSON.stringify(clue)}`); logger.info(`${flag}线索: ${JSON.stringify(clue)}`);
logger.info('==============================================================================='); logger.info('===============================================================================');
} }
...@@ -288,13 +286,13 @@ class Autohome extends Base { ...@@ -288,13 +286,13 @@ class Autohome extends Base {
clueInputType: this.params.clueInputType, clueInputType: this.params.clueInputType,
}); });
} else { } else {
logger.info(`accountID: ${this.params.accountID}, 时间段(${params.startTime} - ${params.endtime})没有线索`); logger.info(`时间段(${params.startTime} - ${params.endtime})没有线索`);
} }
// 判断是否抓取完全 // 判断是否抓取完全
if (customerIndex < rowCount) { if (customerIndex < rowCount) {
let randomSecs = _.random(1, 5); let randomSecs = _.random(1, 5);
logger.info(`accountID: ${this.params.accountID}, 随机等待${randomSecs}秒`); logger.info(`随机等待${randomSecs}秒`);
await Promise.delay(randomSecs*1000).then(async function() { await Promise.delay(randomSecs*1000).then(async function() {
params.pageIndex += 1; params.pageIndex += 1;
await fetchByPage(); await fetchByPage();
...@@ -304,9 +302,9 @@ class Autohome extends Base { ...@@ -304,9 +302,9 @@ class Autohome extends Base {
} }
await fetchByPage(); await fetchByPage();
await this.updateLatestFetch(); await this.updateLatestFetch();
logger.info(`accountID: ${this.params.accountID}, 线索总数: ${rowCount}, 线索重复: ${rowDuplicate}, 新增线索: ${rowNew}`); logger.info(`线索总数: ${rowCount}, 线索重复: ${rowDuplicate}, 新增线索: ${rowNew}`);
} catch (e) { } catch (e) {
logger.error(`accountID: ${this.params.accountID}, ${e}`); logger.error(`${e}`);
} }
} }
} }
......
...@@ -35,7 +35,7 @@ class Easypass extends Base { ...@@ -35,7 +35,7 @@ class Easypass extends Base {
try { try {
oldCookies = await DealerHelper.getCookies(this.params); oldCookies = await DealerHelper.getCookies(this.params);
} catch (e) { } catch (e) {
logger.debug(`accountID: ${this.params.accountID}, 没有cookies: ${e}`); logger.debug(`没有cookies: ${e}`);
} }
if (oldCookies) { if (oldCookies) {
...@@ -64,7 +64,7 @@ class Easypass extends Base { ...@@ -64,7 +64,7 @@ class Easypass extends Base {
const params = this.params; const params = this.params;
params.cookies = newCookies; params.cookies = newCookies;
logger.debug(`accountID: ${this.params.accountID}, cookies: ${JSON.stringify(newCookies)}`); logger.debug(`cookies: ${JSON.stringify(newCookies)}`);
await DealerHelper.saveCookies(params); await DealerHelper.saveCookies(params);
...@@ -78,7 +78,7 @@ class Easypass extends Base { ...@@ -78,7 +78,7 @@ class Easypass extends Base {
// 随机返回登录状态 // 随机返回登录状态
// return _.random(0, 1); // return _.random(0, 1);
// return [new errors.LoginError('登录失败'), _.random(0, 1)]; // return [new errors.LoginError('登录失败'), _.random(0, 1)];
logger.info(`accountID: ${this.params.accountID}, 开始表单登录`); logger.info(`开始表单登录`);
const username = this.params.username; const username = this.params.username;
const password = this.params.password; const password = this.params.password;
...@@ -108,7 +108,7 @@ class Easypass extends Base { ...@@ -108,7 +108,7 @@ class Easypass extends Base {
try { try {
const captchaType = config.get(this.params.website)['captchaType']; const captchaType = config.get(this.params.website)['captchaType'];
captchaText = await captcha.decodeBase64(captchaType, base64Text); captchaText = await captcha.decodeBase64(captchaType, base64Text);
logger.info(`accountID: ${this.params.accountID}, captchaText: ${captchaText}`); logger.info(`captchaText: ${captchaText}`);
} catch (e) { } catch (e) {
logger.error(e); logger.error(e);
return; return;
...@@ -144,7 +144,7 @@ class Easypass extends Base { ...@@ -144,7 +144,7 @@ class Easypass extends Base {
const params = this.params; const params = this.params;
params.cookies = cookies; params.cookies = cookies;
logger.debug(`accountID: ${this.params.accountID}, cookies: ${JSON.stringify(cookies)}`); logger.debug(`cookies: ${JSON.stringify(cookies)}`);
await DealerHelper.saveCookies(params); await DealerHelper.saveCookies(params);
} }
...@@ -164,7 +164,7 @@ class Easypass extends Base { ...@@ -164,7 +164,7 @@ class Easypass extends Base {
} catch (e) { } catch (e) {
// TODO:需要考虑密码、验证码等因素 // TODO:需要考虑密码、验证码等因素
// TODO:如果抓取线索过程中cookie失效可能也需要尝试重新登录 // TODO:如果抓取线索过程中cookie失效可能也需要尝试重新登录
logger.error(`accountID: ${this.params.accountID}, 抓取线索登录失败: ${e}`); logger.error(`抓取线索登录失败: ${e}`);
return; return;
} }
...@@ -193,7 +193,7 @@ class Easypass extends Base { ...@@ -193,7 +193,7 @@ class Easypass extends Base {
} }
const txtEndTime = moment().format('YYYY-MM-DD'); const txtEndTime = moment().format('YYYY-MM-DD');
logger.info(`accountID: ${this.params.accountID}, 线索抓取范围: ${txtBeginTime} - ${txtEndTime}`); logger.info(`线索抓取范围: ${txtBeginTime} - ${txtEndTime}`);
await await
horseman horseman
...@@ -250,7 +250,7 @@ class Easypass extends Base { ...@@ -250,7 +250,7 @@ class Easypass extends Base {
_.pick(clue, 'customerPhone', 'intentionDes', 'createDate'), _.pick(clue, 'customerPhone', 'intentionDes', 'createDate'),
), true, true); ), true, true);
logger.info(`accountID: ${this.params.accountID}, hashBase: ${hashBase}`); logger.info(`hashBase: ${hashBase}`);
rowCount += 1; rowCount += 1;
...@@ -264,7 +264,7 @@ class Easypass extends Base { ...@@ -264,7 +264,7 @@ class Easypass extends Base {
clues.push(clue); clues.push(clue);
} }
logger.info(`accountID: ${this.params.accountID}, ${flag}线索: ${JSON.stringify(clue)}`); logger.info(`${flag}线索: ${JSON.stringify(clue)}`);
logger.info('==============================================================================='); logger.info('===============================================================================');
} }
...@@ -276,7 +276,7 @@ class Easypass extends Base { ...@@ -276,7 +276,7 @@ class Easypass extends Base {
accountID: this.params.accountID, accountID: this.params.accountID,
}); });
} else { } else {
logger.info(`accountID: ${this.params.accountID}, 时间段(${txtBeginTime} - ${txtEndTime})没有线索`); logger.info(`时间段(${txtBeginTime} - ${txtEndTime})没有线索`);
} }
// 判断是否最后一页有两种情况:1.只有一页时分页按钮不存在 2.末页按钮置灰 // 判断是否最后一页有两种情况:1.只有一页时分页按钮不存在 2.末页按钮置灰
...@@ -295,7 +295,7 @@ class Easypass extends Base { ...@@ -295,7 +295,7 @@ class Easypass extends Base {
} }
let randomSecs = _.random(1, 5); let randomSecs = _.random(1, 5);
logger.info(`accountID: ${this.params.accountID}, 随机等待${randomSecs}秒`); logger.info(`随机等待${randomSecs}秒`);
await Promise.delay(randomSecs*1000).then(async function() { await Promise.delay(randomSecs*1000).then(async function() {
await fetchByPage(); await fetchByPage();
}); });
...@@ -304,9 +304,9 @@ class Easypass extends Base { ...@@ -304,9 +304,9 @@ class Easypass extends Base {
await fetchByPage(); await fetchByPage();
await horseman.close(); await horseman.close();
await this.updateLatestFetch(); await this.updateLatestFetch();
logger.info(`accountID: ${this.params.accountID}, 线索总数: ${rowCount}, 线索重复: ${rowDuplicate}, 新增线索: ${rowNew}`); logger.info(`线索总数: ${rowCount}, 线索重复: ${rowDuplicate}, 新增线索: ${rowNew}`);
} catch (e) { } catch (e) {
logger.error(`accountID: ${this.params.accountID}, ${e}`); logger.error(`${e}`);
} }
} }
} }
......
...@@ -3,31 +3,20 @@ const dealer = require('./dealer'); ...@@ -3,31 +3,20 @@ const dealer = require('./dealer');
class Spider { class Spider {
constructor(params) { constructor(params) {
let self = this;
this.params = Object.assign({}, params); this.params = Object.assign({}, params);
this.spider = this.getSpider(); this.spider = this.getSpider();
} }
getSpider() { getSpider() {
let spider; const spiderClassMap = {
switch (this.params.website) { autoifeng: 'Autoifeng',
case 'autoifeng': { autohome: 'Autohome',
spider = new dealer.Autoifeng(this.params); easypass: 'Easypass',
break;
}
case 'autohome': {
spider = new dealer.Autohome(this.params);
break;
}
case 'easypass': {
spider = new dealer.Easypass(this.params);
break;
}
} }
if (spider) { try {
return spider; return new dealer[spiderClassMap[this.params.website]](this.params);
} else { } catch (e) {
throw new Error('Spider not found'); throw new Error(`Spider not found: ${e}`);
} }
} }
......
...@@ -8,17 +8,9 @@ global.__basedir = __dirname; ...@@ -8,17 +8,9 @@ global.__basedir = __dirname;
global.__libdir = __basedir + '/lib'; global.__libdir = __basedir + '/lib';
const DI = require('./lib/DI'); const DI = require('./lib/DI');
const logger = DI.getLogger(); DI.f = 'mawei';
DI.name = 'mawei'; DI.LOG_MARK = 'AID:1';
DI.setLogMark('SPIDER', 'accountID:1'); require('./test2');
console.log(DI.entrance);
logger.addContext('user', 'Main');
logger.trace('Entering cheese testing');
logger.debug('Got cheese.');
logger.info('Cheese is Gouda.');
logger.warn('Cheese is quite smelly.');
logger.error('Cheese is too ripe!');
logger.fatal('Cheese was breeding ground for listeria.');
return; return;
console.log(_.random(1, 5)); console.log(_.random(1, 5));
......
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