From 5abd6dde5b70e38d07d9c6858daa031d334dd938 Mon Sep 17 00:00:00 2001 From: zk Date: Sun, 24 May 2026 16:33:28 +0100 Subject: [PATCH] fix: improve request logging (#1578) * fix: improve request logging * fix: also fix this while i'm here --- typescript/bot/src/config.ts | 2 +- typescript/server/src/server/middleware/request-logger.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/typescript/bot/src/config.ts b/typescript/bot/src/config.ts index 0f99c1714..b7631fdad 100644 --- a/typescript/bot/src/config.ts +++ b/typescript/bot/src/config.ts @@ -22,7 +22,7 @@ function ParseGameChannels(raw: string | undefined): Partial { return; } + // @ts-expect-error set by {@link ResJsonInteceptor} when handlers use `res.json` + const responseBody: unknown | undefined = res.contentBody; + const contents = { statusCode: res.statusCode, requestQuery: req.query, requestBody: safeBody, + // Explains validation/import failures etc.; otherwise logs only show the status code. + ...(responseBody !== undefined && res.statusCode >= 400 && { responseBody }), // This might actually be undefined, as it could be called in some weird scenarios? from: (req[SYMBOL_TACHI_API_AUTH] as APITokenDocument | undefined)?.userID ?? null,