chore: log response size

This commit is contained in:
Chareice 2024-11-05 12:43:37 +08:00
parent 0e46d78c3c
commit 2f9436d539
No known key found for this signature in database

View File

@ -71,6 +71,7 @@ export const requestLogger = (appName: string, requestLogger: Logger, options?:
cost, cost,
app: appName, app: appName,
reqId, reqId,
bodySize: ctx.response.length,
}; };
if (Math.floor(status / 100) == 5) { if (Math.floor(status / 100) == 5) {
requestLogger.error({ ...info, res: ctx.body?.['errors'] || ctx.body }); requestLogger.error({ ...info, res: ctx.body?.['errors'] || ctx.body });