Skip to content

Commit

Permalink
Limit Payload _debugDescription
Browse files Browse the repository at this point in the history
  • Loading branch information
atdrendel committed Jan 28, 2021
1 parent 30e799a commit a9f3b6e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Sources/Phoenix/Payload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ public typealias Payload = [String: Any]
extension Dictionary where Key == String, Value == Any {
var _debugDescription: String {
let contents = self
.map { "\($0.key):\(String(describing: $0.value))" }
.map { (key, value) in
let maxLength = 32
let valueStr = String(describing: value)
let truncatedValue = valueStr.count > maxLength ?
"\(valueStr.prefix(maxLength))..." :
valueStr
return "\(key):\(truncatedValue)"
}
.joined(separator: ",")
return "{\(contents)}"
}
Expand Down

0 comments on commit a9f3b6e

Please sign in to comment.