chore(logger): append url to request log message (#3296)

This commit is contained in:
YANG QIA 2024-01-02 09:35:46 +08:00 committed by GitHub
parent e99c2f2011
commit 66ee3f6864
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,7 +35,7 @@ export const requestLogger = (appName: string, options?: RequestLoggerOptions) =
path: ctx.url,
};
requestLogger.info({
message: 'request',
message: `request ${ctx.method} ${ctx.url}`,
...requestInfo,
req: pick(ctx.request.toJSON(), options?.requestWhitelist || defaultRequestWhitelist),
action: ctx.action?.toJSON?.(),
@ -51,7 +51,7 @@ export const requestLogger = (appName: string, options?: RequestLoggerOptions) =
const cost = Date.now() - startTime;
const status = ctx.status;
const info = {
message: 'response',
message: `response ${ctx.url}`,
...requestInfo,
res: pick(ctx.response.toJSON(), options?.responseWhitelist || defaultResponseWhitelist),
action: ctx.action?.toJSON?.(),