Gateway: optimize ws logs in normal mode

This commit is contained in:
Peter Steinberger
2025-12-18 13:27:45 +00:00
parent 0b8e8144af
commit d406d3a058
4 changed files with 160 additions and 9 deletions

View File

@@ -58,8 +58,8 @@ export function registerGatewayCli(program: Command) {
.option("--verbose", "Verbose logging to stdout/stderr", false)
.option(
"--ws-log <style>",
'Verbose WebSocket log style ("full"|"compact")',
"full",
'WebSocket log style ("auto"|"full"|"compact")',
"auto",
)
.option("--compact", 'Alias for "--ws-log compact"', false)
.action(async (opts) => {
@@ -68,13 +68,18 @@ export function registerGatewayCli(program: Command) {
| string
| undefined;
const wsLogStyle: GatewayWsLogStyle =
wsLogRaw === "compact" ? "compact" : "full";
wsLogRaw === "compact"
? "compact"
: wsLogRaw === "full"
? "full"
: "auto";
if (
wsLogRaw !== undefined &&
wsLogRaw !== "auto" &&
wsLogRaw !== "compact" &&
wsLogRaw !== "full"
) {
defaultRuntime.error('Invalid --ws-log (use "full" or "compact")');
defaultRuntime.error('Invalid --ws-log (use "auto", "full", "compact")');
defaultRuntime.exit(1);
}
setGatewayWsLogStyle(wsLogStyle);