数数:日志模式用pinus-logger替代

This commit is contained in:
luying
2022-05-23 21:19:49 +08:00
parent 874caa7bed
commit 8486d3fee8
5 changed files with 431 additions and 16 deletions

View File

@@ -10,7 +10,6 @@ import { request37CheckChat, request37GetWord, request37Post } from "../pubUtils
import { GuildModel } from "../db/Guild";
import { getRoleOnlineInfo, updateUserInfo } from "./redisService";
import { Application, pinus } from "pinus";
import { getGuildChannelSid } from "./chatService";
import { getRandSingleEelm, parseGoodStr, readWordTxt, resResult, writeWordTxt } from "../pubUtils/util";
const ThinkingAnalytics = require("thinkingdata-node");
import Trie from '../pubUtils/trie';
@@ -21,6 +20,7 @@ import { SurveyModel } from "../db/Survery";
import { pushGuildInfoUpdate } from "./guildService";
import { sendMessageToUserWithSuc } from "./pushService";
import { GuildLeader } from "../domain/rank";
import { initTaLoggingMode } from "./sdk/ta";
// 检查私聊是否合法
@@ -171,9 +171,7 @@ export function connectThinkingData(app: Application) {
} else if (THINKING_DATA_MODE == THINKING_DATA_MODE_LIST.BATCH) {
ta = ThinkingAnalytics.initWithBatchMode(SDK_TA_CONST.APPID, SDK_TA_CONST.SERVER_URL);
} else if (THINKING_DATA_MODE == THINKING_DATA_MODE_LIST.LOGGING) {
ta = ThinkingAnalytics.initWithLoggingMode(SDK_TA_CONST.LOG_PATH, {
pm2: true
});
ta = initTaLoggingMode();
}
ta.setDynamicSuperProperties(() => {
return {
@@ -245,8 +243,8 @@ export async function reportCreateRoleEventToTa(role: RoleType, ip: string) {
export function taflush() {
let ta = pinus.app.get('ta');
if(!ta) return;
ta.flush();
ta.close();
if(ta.flush) ta.flush();
if(ta.close) ta.close();
}
export async function fetch37Words() {