chore(discord): restore gateway log context
This commit is contained in:
@@ -36,11 +36,11 @@ describe("attachDiscordGatewayLogging", () => {
|
||||
expect(runtime.log).toHaveBeenCalledTimes(2);
|
||||
expect(runtime.log).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
"gateway: WebSocket connection closed with code 1001",
|
||||
"discord gateway: WebSocket connection closed with code 1001",
|
||||
);
|
||||
expect(runtime.log).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
"gateway: Reconnecting with backoff: 1000ms after code 1001",
|
||||
"discord gateway: Reconnecting with backoff: 1000ms after code 1001",
|
||||
);
|
||||
|
||||
cleanup();
|
||||
|
||||
@@ -40,18 +40,18 @@ export function attachDiscordGatewayLogging(params: {
|
||||
|
||||
const onGatewayDebug = (msg: unknown) => {
|
||||
const message = String(msg);
|
||||
logVerbose(`gateway: ${message}`);
|
||||
logVerbose(`discord gateway: ${message}`);
|
||||
if (shouldPromoteGatewayDebug(message)) {
|
||||
runtime.log?.(`gateway: ${message}`);
|
||||
runtime.log?.(`discord gateway: ${message}`);
|
||||
}
|
||||
};
|
||||
|
||||
const onGatewayWarning = (warning: unknown) => {
|
||||
logVerbose(`gateway warning: ${String(warning)}`);
|
||||
logVerbose(`discord gateway warning: ${String(warning)}`);
|
||||
};
|
||||
|
||||
const onGatewayMetrics = (metrics: unknown) => {
|
||||
logVerbose(`gateway metrics: ${formatGatewayMetrics(metrics)}`);
|
||||
logVerbose(`discord gateway metrics: ${formatGatewayMetrics(metrics)}`);
|
||||
};
|
||||
|
||||
emitter.on("debug", onGatewayDebug);
|
||||
|
||||
@@ -661,7 +661,7 @@ export async function monitorDiscordProvider(opts: MonitorDiscordOpts = {}) {
|
||||
if (!gateway?.isConnected) {
|
||||
runtime.log?.(
|
||||
danger(
|
||||
`[discord] connection stalled: no HELLO received within ${HELLO_TIMEOUT_MS}ms, forcing reconnect`,
|
||||
`connection stalled: no HELLO received within ${HELLO_TIMEOUT_MS}ms, forcing reconnect`,
|
||||
),
|
||||
);
|
||||
gateway?.disconnect();
|
||||
@@ -681,7 +681,7 @@ export async function monitorDiscordProvider(opts: MonitorDiscordOpts = {}) {
|
||||
: undefined,
|
||||
abortSignal: opts.abortSignal,
|
||||
onGatewayError: (err) => {
|
||||
runtime.error?.(danger(`gateway error: ${String(err)}`));
|
||||
runtime.error?.(danger(`discord gateway error: ${String(err)}`));
|
||||
},
|
||||
shouldStopOnError: (err) => {
|
||||
const message = String(err);
|
||||
|
||||
Reference in New Issue
Block a user