Skip to content

Commit

Permalink
Logging: log entire cache key with verbose logs (#2888)
Browse files Browse the repository at this point in the history
  • Loading branch information
NachoSoto authored Jul 27, 2023
1 parent 689e1c6 commit 1de817f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Sources/FoundationExtensions/OperationQueue+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ extension OperationQueue {
case .firstCallbackAddedToList:
self.addOperation(factory.create())
case .addedToExistingInFlightList:
Logger.debug(Strings.network.reusing_existing_request_for_operation(T.self, factory.cacheKey))
Logger.debug(
Strings.network.reusing_existing_request_for_operation(
T.self,
Logger.logLevel == .verbose
? factory.cacheKey
: factory.cacheKey.prefix(15) + ""
)
)
return
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Logging/Strings/NetworkStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ extension NetworkStrings: LogMessage {

case let .reusing_existing_request_for_operation(operationType, cacheKey):
return "Network operation '\(operationType)' found with the same cache key " +
"'\(cacheKey.prefix(15))...'. Skipping request."
"'\(cacheKey)'. Skipping request."

case let .creating_json_error(error):
return "Error creating request with body: \(error)"
Expand Down

0 comments on commit 1de817f

Please sign in to comment.