diff --git a/src/gateway/ws-log.ts b/src/gateway/ws-log.ts index d75986c756d..9e2dfdbe4b5 100644 --- a/src/gateway/ws-log.ts +++ b/src/gateway/ws-log.ts @@ -25,6 +25,25 @@ const wsInflightOptimized = new Map(); const wsInflightSince = new Map(); const wsLog = createSubsystemLogger("gateway/ws"); +const WS_META_SKIP_KEYS = new Set(["connId", "id", "method", "ok", "event"]); + +function collectWsRestMeta(meta?: Record): string[] { + const restMeta: string[] = []; + if (!meta) { + return restMeta; + } + for (const [key, value] of Object.entries(meta)) { + if (value === undefined) { + continue; + } + if (WS_META_SKIP_KEYS.has(key)) { + continue; + } + restMeta.push(`${chalk.dim(key)}=${formatForLog(value)}`); + } + return restMeta; +} + export function shouldLogWs(): boolean { return shouldLogSubsystemToConsole("gateway/ws"); } @@ -252,24 +271,7 @@ export function logWs(direction: "in" | "out", kind: string, meta?: Record