@@ -16,14 +16,14 @@ export const loggerMiddleware =
16
16
context : HandlerExecutionContext
17
17
) : InitializeHandler < any , Output > =>
18
18
async ( args : InitializeHandlerArguments < any > ) : Promise < InitializeHandlerOutput < Output > > => {
19
- const { clientName, commandName, logger, dynamoDbDocumentClientOptions = { } } = context ;
20
-
21
- const { overrideInputFilterSensitiveLog, overrideOutputFilterSensitiveLog } = dynamoDbDocumentClientOptions ;
22
- const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context . inputFilterSensitiveLog ;
23
- const outputFilterSensitiveLog = overrideOutputFilterSensitiveLog ?? context . outputFilterSensitiveLog ;
24
-
25
19
try {
26
20
const response = await next ( args ) ;
21
+ const { clientName, commandName, logger, dynamoDbDocumentClientOptions = { } } = context ;
22
+
23
+ const { overrideInputFilterSensitiveLog, overrideOutputFilterSensitiveLog } = dynamoDbDocumentClientOptions ;
24
+ const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context . inputFilterSensitiveLog ;
25
+ const outputFilterSensitiveLog = overrideOutputFilterSensitiveLog ?? context . outputFilterSensitiveLog ;
26
+
27
27
const { $metadata, ...outputWithoutMetadata } = response . output ;
28
28
logger ?. info ?.( {
29
29
clientName,
@@ -34,6 +34,11 @@ export const loggerMiddleware =
34
34
} ) ;
35
35
return response ;
36
36
} catch ( error ) {
37
+ const { clientName, commandName, logger, dynamoDbDocumentClientOptions = { } } = context ;
38
+
39
+ const { overrideInputFilterSensitiveLog } = dynamoDbDocumentClientOptions ;
40
+ const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context . inputFilterSensitiveLog ;
41
+
37
42
logger ?. error ?.( {
38
43
clientName,
39
44
commandName,
0 commit comments