日志控制
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
*/
|
||||
import { BaseData } from "./BaseData";
|
||||
import proto from "db://assets/Scripts/proto/proto.pb.js";
|
||||
import { logger } from "db://assets/Scripts/Main/Common/Logger";
|
||||
|
||||
// 数据结构
|
||||
export interface AiCharacters {
|
||||
@@ -69,7 +70,7 @@ export class AiCharacterData extends BaseData {
|
||||
try {
|
||||
parsed = JSON.parse(data.data);
|
||||
} catch (e) {
|
||||
console.warn("AiCharacterData JSON 解析失败", e);
|
||||
logger.warn("AiCharacterData JSON 解析失败", e);
|
||||
return;
|
||||
}
|
||||
// 解析数据
|
||||
|
||||
@@ -108,7 +108,7 @@ export class ChatModel {
|
||||
//const roleDetail = ConfigManager.tables.TbGirlsDetail.get(roleId);
|
||||
|
||||
if (!girlData) {
|
||||
console.error(`ChatModel: Role data not found for roleId ${girlId}`);
|
||||
logger.error(`ChatModel: Role data not found for roleId ${girlId}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ export class ChatModel {
|
||||
|
||||
return newRoleData;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
logger.error(
|
||||
`ChatModel: Failed to create role data for ${girlId}:`,
|
||||
error
|
||||
);
|
||||
@@ -208,18 +208,18 @@ export class ChatModel {
|
||||
public addDialog(isPlayer: boolean, content: string, roleId?: number): void {
|
||||
const targetRoleId = roleId || this.currentGirlId;
|
||||
if (!targetRoleId) {
|
||||
console.warn("ChatModel: Cannot add dialog - no active role");
|
||||
logger.warn("ChatModel: Cannot add dialog - no active role");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!content || content.trim() === "") {
|
||||
console.warn("ChatModel: Cannot add empty dialog content");
|
||||
logger.warn("ChatModel: Cannot add empty dialog content");
|
||||
return;
|
||||
}
|
||||
|
||||
const roleData = this.rolesData.get(targetRoleId);
|
||||
if (!roleData) {
|
||||
console.warn(`ChatModel: Role data not found for roleId ${targetRoleId}`);
|
||||
logger.warn(`ChatModel: Role data not found for roleId ${targetRoleId}`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ export class DataManager {
|
||||
*/
|
||||
private register<T extends BaseData>(dataId: string, ctor: DataCtor<T>): void {
|
||||
if (this._config.has(dataId)) {
|
||||
console.warn(`[DataManager] 重复注册数据ID: ${dataId},将覆盖旧构造器`);
|
||||
logger.warn(`[DataManager] 重复注册数据ID: ${dataId},将覆盖旧构造器`);
|
||||
}
|
||||
this._config.set(dataId, ctor);
|
||||
}
|
||||
@@ -108,7 +108,7 @@ export class DataManager {
|
||||
// 缓存没有→ 查找构造器
|
||||
const Ctor = this._config.get(dataId) as DataCtor<T> | undefined;
|
||||
if (!Ctor) {
|
||||
console.warn(`[DataManager] 未找到 dataId 的构造器配置: ${dataId}`);
|
||||
logger.warn(`[DataManager] 未找到 dataId 的构造器配置: ${dataId}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user