From 1d3efa84d74629ced4fe267e5a763b9e1cc537bc Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Mon, 21 Dec 2020 21:18:50 +0000 Subject: [PATCH] chore(middleware-logger): emit $metadata from output --- .../src/loggerMiddleware.spec.ts | 22 ++----------------- .../middleware-logger/src/loggerMiddleware.ts | 12 +--------- 2 files changed, 3 insertions(+), 31 deletions(-) diff --git a/packages/middleware-logger/src/loggerMiddleware.spec.ts b/packages/middleware-logger/src/loggerMiddleware.spec.ts index 9a5d71484d671..4b6562b485afc 100644 --- a/packages/middleware-logger/src/loggerMiddleware.spec.ts +++ b/packages/middleware-logger/src/loggerMiddleware.spec.ts @@ -110,16 +110,7 @@ describe("loggerMiddleware", () => { commandName, input: mockInputLog, output: mockOutputLog, - metadata: { - statusCode: mockResponse.response.statusCode, - requestId: mockResponse.response.headers["x-amzn-requestid"], - extendedRequestId: mockResponse.response.headers["x-amz-id-2"], - cfId: mockResponse.response.headers["x-amz-cf-id"], - retry: { - attempts: $metadata.attempts, - totalDelay: $metadata.totalRetryDelay, - }, - }, + metadata: $metadata, }); }); @@ -154,16 +145,7 @@ describe("loggerMiddleware", () => { expect(logger.info).toHaveBeenCalledWith({ input: mockArgs.input, output: outputWithoutMetadata, - metadata: { - statusCode: customResponse.response.statusCode, - requestId: requestIdBackup, - extendedRequestId: undefined, - cfId: undefined, - retry: { - attempts: $metadata.attempts, - totalDelay: $metadata.totalRetryDelay, - }, - }, + metadata: $metadata, }); }); }); diff --git a/packages/middleware-logger/src/loggerMiddleware.ts b/packages/middleware-logger/src/loggerMiddleware.ts index c4c0117ef143d..577e3e2f572a9 100644 --- a/packages/middleware-logger/src/loggerMiddleware.ts +++ b/packages/middleware-logger/src/loggerMiddleware.ts @@ -25,23 +25,13 @@ export const loggerMiddleware = () =>