日志:整理

This commit is contained in:
luying
2021-07-27 18:02:11 +08:00
parent 7bc4ff4577
commit a37935025b
3 changed files with 5 additions and 20 deletions

View File

@@ -152,7 +152,7 @@ app.configure(ALL_ENVS, 'systimer', function () {
function errorHandler(err: Error, msg: any, resp: any,
session: FrontendOrBackendSession, cb: HandlerCallback) {
const errCode = genCode(10);
errlogger.error(`${pinus.app.serverId} error handler \n msg[${JSON.stringify(msg)}] \n resp[${JSON.stringify(resp)}] \n sessionId:${JSON.stringify(session.export())} \n error *${errCode}* stack: ${err.stack}`);
errlogger.error(`${pinus.app.serverId} error handler \n msg[${JSON.stringify(msg)}] \n resp[${JSON.stringify(resp)}] \n sessionId:${JSON.stringify(session.export())} \n error ${errCode} stack: ${err.stack}`);
if (!resp) {
resp = resResult(STATUS.GLOBAL_ERR, { errCode });
@@ -162,12 +162,8 @@ function errorHandler(err: Error, msg: any, resp: any,
export function globalErrorHandler(err: Error, msg: any, resp: any,
session: FrontendOrBackendSession, cb: HandlerCallback) {
errlogger.debug(`${pinus.app.serverId} globalErrorHandler handler`);
errlogger.debug(`msg[${JSON.stringify(msg)}]`);
errlogger.debug(`resp[${JSON.stringify(resp)}]`);
errlogger.debug(`sessionId:${JSON.stringify(session.export())}`);
errlogger.error(`error stack: ${err.stack}`);
const errCode = genCode(10);
errlogger.error(`${pinus.app.serverId} globalErrorHandler handler \n msg[${JSON.stringify(msg)}] \n resp[${JSON.stringify(resp)}] \n sessionId:${JSON.stringify(session.export())} \n error 【${errCode}】 stack: ${err.stack}`);
if (cb) {
cb(err, resp ? resp : { code: 503 });

View File

@@ -309,9 +309,4 @@ export class EntryHandler {
return resResult(STATUS.SUCCESS);
}
async test(msg: { magicWord: string }, session: FrontendSession) {
let rec = await WhiteListModel.checkTel(1, 2, 'xxxxx');
return resResult(STATUS.SUCCESS);
}
}

View File

@@ -1,5 +1,5 @@
import BaseModel, { getModelForClass } from './BaseModel';
import { prop, DocumentType } from '@typegoose/typegoose';
import BaseModel from './BaseModel';
import { prop, DocumentType, getModelForClass } from '@typegoose/typegoose';
import { WHITE_LIST_TYPE } from '../consts';
export default class WhiteList extends BaseModel {
@@ -19,12 +19,6 @@ export default class WhiteList extends BaseModel {
const rec: WhiteListModelType = await WhiteListModel.findOne({ type: WHITE_LIST_TYPE.TEL, str: tel }).lean();
return rec;
}
public static async test(a: number, b: number, c: string) {
console.log(a, b, c)
const rec: WhiteListModelType = await WhiteListModel.findOneAndUpdate({}, { type: [] as any }).lean();
return rec;
}
}
export const WhiteListModel = getModelForClass(WhiteList);