style: biome format ws logging

This commit is contained in:
Peter Steinberger
2025-12-18 14:31:10 +01:00
parent d406d3a058
commit 856ce06fda
2 changed files with 10 additions and 7 deletions

View File

@@ -79,7 +79,9 @@ export function registerGatewayCli(program: Command) {
wsLogRaw !== "compact" &&
wsLogRaw !== "full"
) {
defaultRuntime.error('Invalid --ws-log (use "auto", "full", "compact")');
defaultRuntime.error(
'Invalid --ws-log (use "auto", "full", "compact")',
);
defaultRuntime.exit(1);
}
setGatewayWsLogStyle(wsLogStyle);

View File

@@ -90,10 +90,6 @@ import { setHeartbeatsEnabled } from "../web/auto-reply.js";
import { sendMessageWhatsApp } from "../web/outbound.js";
import { requestReplyHeartbeatNow } from "../web/reply-heartbeat-wake.js";
import { buildMessageWithAttachments } from "./chat-attachments.js";
import {
DEFAULT_WS_SLOW_MS,
getGatewayWsLogStyle,
} from "./ws-logging.js";
import {
type ConnectParams,
ErrorCodes,
@@ -131,6 +127,7 @@ import {
validateSessionsPatchParams,
validateWakeParams,
} from "./protocol/index.js";
import { DEFAULT_WS_SLOW_MS, getGatewayWsLogStyle } from "./ws-logging.js";
type Client = {
socket: WebSocket;
@@ -606,7 +603,9 @@ function logWsOptimized(
if (direction !== "out" || kind !== "res") return;
const startedAt = inflightKey ? wsInflightOptimized.get(inflightKey) : undefined;
const startedAt = inflightKey
? wsInflightOptimized.get(inflightKey)
: undefined;
if (inflightKey) wsInflightOptimized.delete(inflightKey);
const durationMs =
typeof startedAt === "number" ? Date.now() - startedAt : undefined;
@@ -694,7 +693,9 @@ function logWsCompact(
wsInflightCompact.delete(inflightKey);
}
const durationToken =
typeof startedAt === "number" ? chalk.dim(`${now - startedAt}ms`) : undefined;
typeof startedAt === "number"
? chalk.dim(`${now - startedAt}ms`)
: undefined;
const headline =
(kind === "req" || kind === "res") && method