@aws-sdk/middleware-logger 3.272.0 → 3.288.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,23 +2,36 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getLoggerPlugin = exports.loggerMiddlewareOptions = exports.loggerMiddleware = void 0;
4
4
  const loggerMiddleware = () => (next, context) => async (args) => {
5
- const response = await next(args);
6
- const { clientName, commandName, logger, inputFilterSensitiveLog, outputFilterSensitiveLog, dynamoDbDocumentClientOptions = {}, } = context;
7
- const { overrideInputFilterSensitiveLog, overrideOutputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
8
- if (!logger) {
9
- return response;
10
- }
11
- if (typeof logger.info === "function") {
5
+ var _a, _b;
6
+ try {
7
+ const response = await next(args);
8
+ const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context;
9
+ const { overrideInputFilterSensitiveLog, overrideOutputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
10
+ const inputFilterSensitiveLog = overrideInputFilterSensitiveLog !== null && overrideInputFilterSensitiveLog !== void 0 ? overrideInputFilterSensitiveLog : context.inputFilterSensitiveLog;
11
+ const outputFilterSensitiveLog = overrideOutputFilterSensitiveLog !== null && overrideOutputFilterSensitiveLog !== void 0 ? overrideOutputFilterSensitiveLog : context.outputFilterSensitiveLog;
12
12
  const { $metadata, ...outputWithoutMetadata } = response.output;
13
- logger.info({
13
+ (_a = logger === null || logger === void 0 ? void 0 : logger.info) === null || _a === void 0 ? void 0 : _a.call(logger, {
14
14
  clientName,
15
15
  commandName,
16
- input: (overrideInputFilterSensitiveLog !== null && overrideInputFilterSensitiveLog !== void 0 ? overrideInputFilterSensitiveLog : inputFilterSensitiveLog)(args.input),
17
- output: (overrideOutputFilterSensitiveLog !== null && overrideOutputFilterSensitiveLog !== void 0 ? overrideOutputFilterSensitiveLog : outputFilterSensitiveLog)(outputWithoutMetadata),
16
+ input: inputFilterSensitiveLog(args.input),
17
+ output: outputFilterSensitiveLog(outputWithoutMetadata),
18
18
  metadata: $metadata,
19
19
  });
20
+ return response;
21
+ }
22
+ catch (error) {
23
+ const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context;
24
+ const { overrideInputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
25
+ const inputFilterSensitiveLog = overrideInputFilterSensitiveLog !== null && overrideInputFilterSensitiveLog !== void 0 ? overrideInputFilterSensitiveLog : context.inputFilterSensitiveLog;
26
+ (_b = logger === null || logger === void 0 ? void 0 : logger.error) === null || _b === void 0 ? void 0 : _b.call(logger, {
27
+ clientName,
28
+ commandName,
29
+ input: inputFilterSensitiveLog(args.input),
30
+ error,
31
+ metadata: error.$metadata,
32
+ });
33
+ throw error;
20
34
  }
21
- return response;
22
35
  };
23
36
  exports.loggerMiddleware = loggerMiddleware;
24
37
  exports.loggerMiddlewareOptions = {
@@ -1,21 +1,33 @@
1
1
  export const loggerMiddleware = () => (next, context) => async (args) => {
2
- const response = await next(args);
3
- const { clientName, commandName, logger, inputFilterSensitiveLog, outputFilterSensitiveLog, dynamoDbDocumentClientOptions = {}, } = context;
4
- const { overrideInputFilterSensitiveLog, overrideOutputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
5
- if (!logger) {
6
- return response;
7
- }
8
- if (typeof logger.info === "function") {
2
+ try {
3
+ const response = await next(args);
4
+ const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context;
5
+ const { overrideInputFilterSensitiveLog, overrideOutputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
6
+ const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
7
+ const outputFilterSensitiveLog = overrideOutputFilterSensitiveLog ?? context.outputFilterSensitiveLog;
9
8
  const { $metadata, ...outputWithoutMetadata } = response.output;
10
- logger.info({
9
+ logger?.info?.({
11
10
  clientName,
12
11
  commandName,
13
- input: (overrideInputFilterSensitiveLog ?? inputFilterSensitiveLog)(args.input),
14
- output: (overrideOutputFilterSensitiveLog ?? outputFilterSensitiveLog)(outputWithoutMetadata),
12
+ input: inputFilterSensitiveLog(args.input),
13
+ output: outputFilterSensitiveLog(outputWithoutMetadata),
15
14
  metadata: $metadata,
16
15
  });
16
+ return response;
17
+ }
18
+ catch (error) {
19
+ const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context;
20
+ const { overrideInputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
21
+ const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
22
+ logger?.error?.({
23
+ clientName,
24
+ commandName,
25
+ input: inputFilterSensitiveLog(args.input),
26
+ error,
27
+ metadata: error.$metadata,
28
+ });
29
+ throw error;
17
30
  }
18
- return response;
19
31
  };
20
32
  export const loggerMiddlewareOptions = {
21
33
  name: "loggerMiddleware",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-logger",
3
- "version": "3.272.0",
3
+ "version": "3.288.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "tsc -p tsconfig.cjs.json",