chore(discord): trim gateway log prefixes

This commit is contained in:
Peter Steinberger
2026-01-13 04:22:22 +00:00
parent 8a9096cd52
commit 58d1d11762
3 changed files with 7 additions and 7 deletions

View File

@@ -36,11 +36,11 @@ describe("attachDiscordGatewayLogging", () => {
expect(runtime.log).toHaveBeenCalledTimes(2); expect(runtime.log).toHaveBeenCalledTimes(2);
expect(runtime.log).toHaveBeenNthCalledWith( expect(runtime.log).toHaveBeenNthCalledWith(
1, 1,
"discord gateway: WebSocket connection closed with code 1001", "gateway: WebSocket connection closed with code 1001",
); );
expect(runtime.log).toHaveBeenNthCalledWith( expect(runtime.log).toHaveBeenNthCalledWith(
2, 2,
"discord gateway: Reconnecting with backoff: 1000ms after code 1001", "gateway: Reconnecting with backoff: 1000ms after code 1001",
); );
cleanup(); cleanup();

View File

@@ -40,18 +40,18 @@ export function attachDiscordGatewayLogging(params: {
const onGatewayDebug = (msg: unknown) => { const onGatewayDebug = (msg: unknown) => {
const message = String(msg); const message = String(msg);
logVerbose(`discord gateway: ${message}`); logVerbose(`gateway: ${message}`);
if (shouldPromoteGatewayDebug(message)) { if (shouldPromoteGatewayDebug(message)) {
runtime.log?.(`discord gateway: ${message}`); runtime.log?.(`gateway: ${message}`);
} }
}; };
const onGatewayWarning = (warning: unknown) => { const onGatewayWarning = (warning: unknown) => {
logVerbose(`discord gateway warning: ${String(warning)}`); logVerbose(`gateway warning: ${String(warning)}`);
}; };
const onGatewayMetrics = (metrics: unknown) => { const onGatewayMetrics = (metrics: unknown) => {
logVerbose(`discord gateway metrics: ${formatGatewayMetrics(metrics)}`); logVerbose(`gateway metrics: ${formatGatewayMetrics(metrics)}`);
}; };
emitter.on("debug", onGatewayDebug); emitter.on("debug", onGatewayDebug);

View File

@@ -681,7 +681,7 @@ export async function monitorDiscordProvider(opts: MonitorDiscordOpts = {}) {
: undefined, : undefined,
abortSignal: opts.abortSignal, abortSignal: opts.abortSignal,
onGatewayError: (err) => { onGatewayError: (err) => {
runtime.error?.(danger(`discord gateway error: ${String(err)}`)); runtime.error?.(danger(`gateway error: ${String(err)}`));
}, },
shouldStopOnError: (err) => { shouldStopOnError: (err) => {
const message = String(err); const message = String(err);