Skip to content

Commit 8a5a206

Browse files
author
Sichan Yoo
committed
Change checksum related logging to debug now that checksum calculation in request and validation in response are turned on by default.
1 parent 20a8fb2 commit 8a5a206

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/FlexibleChecksumsRequestMiddleware.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public struct FlexibleChecksumsRequestMiddleware<OperationStackInput, OperationS
4646
try builder.setAwsChunkedHeaders() // x-amz-decoded-content-length
4747
}
4848
} else if case(.noStream) = builder.body {
49-
logger.info("Request body is empty. Skipping request checksum calculation...")
49+
logger.debug("Request body is empty. Skipping request checksum calculation...")
5050
return
5151
}
5252

@@ -82,7 +82,7 @@ public struct FlexibleChecksumsRequestMiddleware<OperationStackInput, OperationS
8282
if requestChecksumRequired || (attributes.requestChecksumCalculation == .whenSupported) {
8383
// If requestChecksumRequired == true OR RequestChecksumCalculation == when_supported, use CRC32 as default algorithm.
8484
checksumHashFunction = ChecksumAlgorithm.from(string: "crc32")!
85-
logger.info("No algorithm chosen by user. Defaulting to CRC32 checksum algorithm.")
85+
logger.debug("No algorithm chosen by user. Defaulting to CRC32 checksum algorithm.")
8686
// If the input member tied to `requestAlgorithmMember` has `@httpHeader` trait in model,
8787
// manually set the header with the name from `@httpHeader` trait with SDK's default algorithm: CRC32.
8888
// This needs to be manually added here because user didn't configure checksumAlgorithm but we're sending default checksum.
@@ -92,9 +92,9 @@ public struct FlexibleChecksumsRequestMiddleware<OperationStackInput, OperationS
9292
}
9393
} else {
9494
// If requestChecksumRequired == false AND RequestChecksumCalculation == when_required, skip calculation.
95-
logger.info("Checksum not required for the operation.")
96-
logger.info("Client config `requestChecksumCalculation` set to `.whenRequired`")
97-
logger.info("No checksum algorithm chosen by the user. Skipping checksum calculation...")
95+
logger.debug("Checksum not required for the operation.")
96+
logger.debug("Client config `requestChecksumCalculation` set to `.whenRequired`")
97+
logger.debug("No checksum algorithm chosen by the user. Skipping checksum calculation...")
9898
return
9999
}
100100
}
@@ -137,7 +137,7 @@ public struct FlexibleChecksumsRequestMiddleware<OperationStackInput, OperationS
137137

138138
func calculateAndAddChecksumHeader(data: Data?) async throws {
139139
guard let data else {
140-
logger.info("Request body is empty. Skipping request checksum calculation...")
140+
logger.debug("Request body is empty. Skipping request checksum calculation...")
141141
return
142142
}
143143
if builder.headers.value(for: checksumHashHeaderName) == nil {

Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/FlexibleChecksumsResponseMiddleware.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public struct FlexibleChecksumsResponseMiddleware<OperationStackInput, Operation
3535
private func validateChecksum(response: HTTPResponse, logger: any LogAgent, attributes: Context) async throws {
3636
// Exit if validation should not be performed
3737
if validationMode != "ENABLED" && attributes.responseChecksumValidation == .whenRequired {
38-
logger.info("Checksum validation should not be performed! Skipping workflow...")
38+
logger.debug("Checksum validation should not be performed! Skipping workflow...")
3939
return
4040
}
4141

@@ -53,7 +53,7 @@ public struct FlexibleChecksumsResponseMiddleware<OperationStackInput, Operation
5353
guard let checksumHeader = checksumHeaderIsPresent else {
5454
let message =
5555
"User requested checksum validation, but the response headers did not contain any valid checksums"
56-
logger.warn(message)
56+
logger.debug(message)
5757
return
5858
}
5959

@@ -75,7 +75,7 @@ public struct FlexibleChecksumsResponseMiddleware<OperationStackInput, Operation
7575
switch response.body {
7676
case .data(let data):
7777
guard let data else {
78-
logger.info("Response body is empty. Skipping response checksum validation...")
78+
logger.debug("Response body is empty. Skipping response checksum validation...")
7979
return
8080
}
8181

@@ -98,7 +98,7 @@ public struct FlexibleChecksumsResponseMiddleware<OperationStackInput, Operation
9898
attributes.httpResponse = response
9999
attributes.httpResponse?.body = validatingStream
100100
case .noStream:
101-
logger.info("Response body is empty. Skipping response checksum validation...")
101+
logger.debug("Response body is empty. Skipping response checksum validation...")
102102
return
103103
}
104104
}

0 commit comments

Comments
 (0)