日志:处理日志保存数量、大小

This commit is contained in:
luying
2022-01-07 18:55:28 +08:00
parent e579457a39
commit f15b6319e3
6 changed files with 533 additions and 9 deletions
@@ -8,7 +8,7 @@ import { UserModel } from "../../../db/User";
import { SERVER_DEBUG_MODE } from "../../../pubUtils/dicParam"; import { SERVER_DEBUG_MODE } from "../../../pubUtils/dicParam";
import { nowSeconds } from "../../../pubUtils/timeUtil"; import { nowSeconds } from "../../../pubUtils/timeUtil";
import { getServerMainten } from "../../../services/gmService"; import { getServerMainten } from "../../../services/gmService";
import { errlogger } from "../../../util/logger"; // import { errlogger } from "../../../util/logger";
export function globalFilter(app: Application) { export function globalFilter(app: Application) {
return new Filter(app); return new Filter(app);
} }
@@ -32,7 +32,7 @@ Filter.prototype.before = async function (routeRecord: RouteRecord, msg: any, se
if(this.accessTime && this.accessTime.has(keyOfRouteWithUser)) { if(this.accessTime && this.accessTime.has(keyOfRouteWithUser)) {
console.log(this.accessTime.get(keyOfRouteWithUser) - Date.now()); console.log(this.accessTime.get(keyOfRouteWithUser) - Date.now());
if(Date.now() - this.accessTime.get(keyOfRouteWithUser) < ACCESS_FREQUENCY) { if(Date.now() - this.accessTime.get(keyOfRouteWithUser) < ACCESS_FREQUENCY) {
errlogger.error(`${keyOfRouteWithUser} 间隔时间小于${ACCESS_FREQUENCY}ms,为 ${Date.now() - this.accessTime.get(keyOfRouteWithUser)}`); // errlogger.error(`${keyOfRouteWithUser} 间隔时间小于${ACCESS_FREQUENCY}ms,为 ${Date.now() - this.accessTime.get(keyOfRouteWithUser)}`);
// return next(new Error(), resResult(STATUS.ACCESS_BUSY)); // return next(new Error(), resResult(STATUS.ACCESS_BUSY));
} }
} }
File diff suppressed because one or more lines are too long
+5 -5
View File
@@ -61,11 +61,11 @@ module.exports = {
'pinus': { 'pinus': {
'type': 'file', 'type': 'file',
'filename': '/zyz_logs/log4js/pinus-${opts:serverId}.log', 'filename': '/zyz_logs/log4js/pinus-${opts:serverId}.log',
'maxLogSize': 1048576, 'maxLogSize': 1073741824,
'layout': { 'layout': {
'type': 'basic' 'type': 'basic'
}, },
'backups': 5 'backups': 20
}, },
'pinus-admin': { 'pinus-admin': {
'type': 'file', 'type': 'file',
@@ -88,16 +88,16 @@ module.exports = {
'app': { 'app': {
'type': 'file', 'type': 'file',
'filename': '/zyz_logs/sls/app.log', 'filename': '/zyz_logs/sls/app.log',
'maxLogSize': 10485760, 'maxLogSize': 1073741824,
'layout': { 'layout': {
'type': 'basic' 'type': 'basic'
}, },
'backups': 15 'backups': 20
}, },
'error': { 'error': {
'type': 'file', 'type': 'file',
'filename': '/zyz_logs/sls/error.log', 'filename': '/zyz_logs/sls/error.log',
'maxLogSize': 1048576, 'maxLogSize': 1073741824,
'layout': { 'layout': {
'type': 'basic' 'type': 'basic'
}, },
+2 -1
View File
@@ -1,5 +1,6 @@
#/bin/bash #/bin/bash
npm install #安装依赖库 npm install #安装依赖库
cp ./channelService.js ./node_modules/pinus/dist/lib/common/service/channelService.js
npm run build npm run build
node pm2Config.js #使用pm2来做进程管理,生成进程配置文件 node pm2Config.js #使用pm2来做进程管理,生成进程配置文件
pm2 start pomeloPm2Start.json #pm2 启动游戏服务器 pm2 start pomeloPm2Start.json #pm2 启动游戏服务器
+1
View File
@@ -9,6 +9,7 @@ if [ $# != 2 ] ; then
fi fi
npm install #安装依赖库 npm install #安装依赖库
cp ./channelService.js ./node_modules/pinus/dist/lib/common/service/channelService.js
npm run build npm run build
node pm2DistributeConfig.js ${1} ${2} #使用pm2来做进程管理,生成进程配置文件 node pm2DistributeConfig.js ${1} ${2} #使用pm2来做进程管理,生成进程配置文件
pm2 start pomeloPm2Start.json #pm2 启动游戏服务器 pm2 start pomeloPm2Start.json #pm2 启动游戏服务器
+1 -1
View File
@@ -238,7 +238,7 @@ export const GK_MAINELITE = {
GKMAINELITE_OPEN_CONDITION: 424, // 梦魇模式开启时间:通过某关卡id GKMAINELITE_OPEN_CONDITION: 424, // 梦魇模式开启时间:通过某关卡id
}; };
export const SERVER_DEBUG_MODE = { export const SERVER_DEBUG_MODE = {
CURRENT_TIME: 1, // 服务器是否打开推送时间debug模式 CURRENT_TIME: 0, // 服务器是否打开推送时间debug模式
CHECK_WORD: 1, // 服务器是否打开屏蔽词校验debug模式 CHECK_WORD: 1, // 服务器是否打开屏蔽词校验debug模式
}; };
export const IS_SQ = { export const IS_SQ = {