style: biome format ws logging
parent
d406d3a058
commit
856ce06fda
|
|
@ -79,7 +79,9 @@ export function registerGatewayCli(program: Command) {
|
||||||
wsLogRaw !== "compact" &&
|
wsLogRaw !== "compact" &&
|
||||||
wsLogRaw !== "full"
|
wsLogRaw !== "full"
|
||||||
) {
|
) {
|
||||||
defaultRuntime.error('Invalid --ws-log (use "auto", "full", "compact")');
|
defaultRuntime.error(
|
||||||
|
'Invalid --ws-log (use "auto", "full", "compact")',
|
||||||
|
);
|
||||||
defaultRuntime.exit(1);
|
defaultRuntime.exit(1);
|
||||||
}
|
}
|
||||||
setGatewayWsLogStyle(wsLogStyle);
|
setGatewayWsLogStyle(wsLogStyle);
|
||||||
|
|
|
||||||
|
|
@ -90,10 +90,6 @@ import { setHeartbeatsEnabled } from "../web/auto-reply.js";
|
||||||
import { sendMessageWhatsApp } from "../web/outbound.js";
|
import { sendMessageWhatsApp } from "../web/outbound.js";
|
||||||
import { requestReplyHeartbeatNow } from "../web/reply-heartbeat-wake.js";
|
import { requestReplyHeartbeatNow } from "../web/reply-heartbeat-wake.js";
|
||||||
import { buildMessageWithAttachments } from "./chat-attachments.js";
|
import { buildMessageWithAttachments } from "./chat-attachments.js";
|
||||||
import {
|
|
||||||
DEFAULT_WS_SLOW_MS,
|
|
||||||
getGatewayWsLogStyle,
|
|
||||||
} from "./ws-logging.js";
|
|
||||||
import {
|
import {
|
||||||
type ConnectParams,
|
type ConnectParams,
|
||||||
ErrorCodes,
|
ErrorCodes,
|
||||||
|
|
@ -131,6 +127,7 @@ import {
|
||||||
validateSessionsPatchParams,
|
validateSessionsPatchParams,
|
||||||
validateWakeParams,
|
validateWakeParams,
|
||||||
} from "./protocol/index.js";
|
} from "./protocol/index.js";
|
||||||
|
import { DEFAULT_WS_SLOW_MS, getGatewayWsLogStyle } from "./ws-logging.js";
|
||||||
|
|
||||||
type Client = {
|
type Client = {
|
||||||
socket: WebSocket;
|
socket: WebSocket;
|
||||||
|
|
@ -606,7 +603,9 @@ function logWsOptimized(
|
||||||
|
|
||||||
if (direction !== "out" || kind !== "res") return;
|
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);
|
if (inflightKey) wsInflightOptimized.delete(inflightKey);
|
||||||
const durationMs =
|
const durationMs =
|
||||||
typeof startedAt === "number" ? Date.now() - startedAt : undefined;
|
typeof startedAt === "number" ? Date.now() - startedAt : undefined;
|
||||||
|
|
@ -694,7 +693,9 @@ function logWsCompact(
|
||||||
wsInflightCompact.delete(inflightKey);
|
wsInflightCompact.delete(inflightKey);
|
||||||
}
|
}
|
||||||
const durationToken =
|
const durationToken =
|
||||||
typeof startedAt === "number" ? chalk.dim(`${now - startedAt}ms`) : undefined;
|
typeof startedAt === "number"
|
||||||
|
? chalk.dim(`${now - startedAt}ms`)
|
||||||
|
: undefined;
|
||||||
|
|
||||||
const headline =
|
const headline =
|
||||||
(kind === "req" || kind === "res") && method
|
(kind === "req" || kind === "res") && method
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue