mirror of
https://github.com/Shu-Ying/noname-shuying.git
synced 2026-10-20 06:10:02 +08:00
feat # 新增日志功能
This commit is contained in:
@@ -1,8 +1,17 @@
|
||||
import { getDiagnostics } from "../../../diagnostics/index.js";
|
||||
|
||||
const lines = [];
|
||||
let pendingWrite = Promise.resolve();
|
||||
|
||||
export function createHandDiagnostics(game, sessionId) {
|
||||
const service = getDiagnostics();
|
||||
const diagnostics = service.scope("mengsan.hand", { sessionId });
|
||||
return (message, error) => {
|
||||
if (service.status().enabled) {
|
||||
if (error) diagnostics.error("hand.failed", error, { message });
|
||||
else diagnostics.info("hand.message", { message });
|
||||
return;
|
||||
}
|
||||
const line = `${new Date().toISOString()} [${sessionId}] ${message}` +
|
||||
(error ? ` ${error.message || error}` : "");
|
||||
console[error ? "warn" : "info"](`梦三手牌 UI:${line}`);
|
||||
|
||||
Reference in New Issue
Block a user