Merge branch 'bugfix' into release
This commit is contained in:
commit
c839d844ec
@ -1,4 +1,5 @@
|
|||||||
import { Db, MongoClient } from "mongodb";
|
import { Db, MongoClient } from "mongodb";
|
||||||
|
import { Logger } from "tsrpc";
|
||||||
|
|
||||||
let logDB:Db;
|
let logDB:Db;
|
||||||
let errorLogDB:Db;
|
let errorLogDB:Db;
|
||||||
@ -28,13 +29,28 @@ async function connGameLogDB() {
|
|||||||
return logDB;
|
return logDB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export let mylogger: Logger = {
|
||||||
|
debug(...args: any[]){
|
||||||
|
console.debug(...args);
|
||||||
|
},
|
||||||
|
log(...args: any[]){
|
||||||
|
console.log(...args);
|
||||||
|
},
|
||||||
|
warn(...args: any[]){
|
||||||
|
console.warn(...args);
|
||||||
|
},
|
||||||
|
error(...args: any[]){
|
||||||
|
addErrorLog( args );
|
||||||
|
console.error(...args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
process.on('uncaughtException',function(err:Error){
|
process.on('uncaughtException',function(err:Error){
|
||||||
addErrorLog((err?.stack)?.toString());
|
addErrorLog( (err?.stack || err)?.toString() );
|
||||||
})
|
})
|
||||||
|
|
||||||
process.on('unhandledRejection', function (err:Error, promise) {
|
process.on('unhandledRejection', function (err:Error, promise) {
|
||||||
addErrorLog((err?.stack)?.toString());
|
addErrorLog( (err?.stack || err)?.toString() );
|
||||||
})
|
})
|
||||||
|
|
||||||
async function addErrorLog(errData:any){
|
async function addErrorLog(errData:any){
|
||||||
|
@ -13,6 +13,7 @@ import {player} from './shared/protocols/user/type';
|
|||||||
import {unQueueByConn} from './api_s2c/user/ApiLogin';
|
import {unQueueByConn} from './api_s2c/user/ApiLogin';
|
||||||
import {clusterPublish, setUidProcessId} from './clusterUtils';
|
import {clusterPublish, setUidProcessId} from './clusterUtils';
|
||||||
import {clearGud, getGud} from './public/gud';
|
import {clearGud, getGud} from './public/gud';
|
||||||
|
import { mylogger } from './gameLog';
|
||||||
|
|
||||||
export async function createWs() {
|
export async function createWs() {
|
||||||
|
|
||||||
@ -25,8 +26,9 @@ export async function createWs() {
|
|||||||
json: true,
|
json: true,
|
||||||
//API超时时间5分钟,为登陆排队做准备
|
//API超时时间5分钟,为登陆排队做准备
|
||||||
apiTimeout: 300000,
|
apiTimeout: 300000,
|
||||||
logLevel: G.argv.logModel as LogLevel
|
logLevel: G.argv.logModel as LogLevel,
|
||||||
});
|
logger:mylogger
|
||||||
|
});
|
||||||
setCrossWs(G.serverCross);
|
setCrossWs(G.serverCross);
|
||||||
await G.serverCross.autoImplementApi(resolve(__dirname, 'api_cross'), true);
|
await G.serverCross.autoImplementApi(resolve(__dirname, 'api_cross'), true);
|
||||||
await G.serverCross.start();
|
await G.serverCross.start();
|
||||||
@ -37,6 +39,7 @@ export async function createWs() {
|
|||||||
wss: getWssFile(),
|
wss: getWssFile(),
|
||||||
//API超时时间5分钟,为登陆排队做准备,只针对游服
|
//API超时时间5分钟,为登陆排队做准备,只针对游服
|
||||||
apiTimeout: 300000,
|
apiTimeout: 300000,
|
||||||
|
logger:mylogger
|
||||||
});
|
});
|
||||||
setWs(G.server);
|
setWs(G.server);
|
||||||
await G.server.autoImplementApi(resolve(__dirname, 'api_s2c'), true);
|
await G.server.autoImplementApi(resolve(__dirname, 'api_s2c'), true);
|
||||||
|
Loading…
Reference in New Issue
Block a user