From c8a76f33ace218683e529ea22a234c32c522a232 Mon Sep 17 00:00:00 2001 From: lyon Date: Thu, 25 Jun 2026 11:02:52 +0800 Subject: [PATCH] fix(hwlab-node): log cloud diagnostics --- internal/cloud/hwpod-node-ws-registry.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/cloud/hwpod-node-ws-registry.ts b/internal/cloud/hwpod-node-ws-registry.ts index 8036c9a3..4b8cc4dd 100644 --- a/internal/cloud/hwpod-node-ws-registry.ts +++ b/internal/cloud/hwpod-node-ws-registry.ts @@ -24,6 +24,7 @@ type PendingDispatch = { export function createHwpodNodeWsRegistry(options: any = {}) { const now = options.now ?? (() => new Date().toISOString()); const clock = options.clock ?? (() => Date.now()); + const logger = options.logger ?? console; const connections = new Map(); const pending = new Map(); const socketConnections = new WeakMap(); @@ -145,6 +146,7 @@ export function createHwpodNodeWsRegistry(options: any = {}) { const diagnostic = normalizeDiagnostic(message.diagnostic, now()); connection.diagnostics.push(diagnostic); if (connection.diagnostics.length > 50) connection.diagnostics = connection.diagnostics.slice(-50); + logger.warn?.(JSON.stringify({ event: "hwpod-node.diagnostic", nodeId: connection.nodeId || nodeId || null, connectionId: connection.id, diagnostic, valuesPrinted: false })); sendJson(connection, { type: "ack", requestId: safeText(message.requestId) || "diagnostic", ok: true, message: "diagnostic recorded" }); return; }