Releases: diegollopis/Kuang
Releases · diegollopis/Kuang
Release list
2.0.0
Network logging overhaul: correlation, retries and latency.
Breaking changes
NetworkLoggingProtocol was redesigned — all methods now take a NetworkLogContext, the response entry takes the attempt's duration, and there is a new retry-decision requirement. Custom logger implementations must adopt the new signatures.
Improvements
Every request now carries a NetworkLogContext — a short request ID shared by all log entries of one call plus a 1-based attempt number — so interleaved concurrent traffic and retries can be told apart.
- Error entries log the prepared request (was always
nil) and the method + URL of the failing attempt - Granted retry decisions are logged with their delay and cause
- Each attempt's duration is reported next to the response status code
- Responses with status ≥ 400 are logged at the error level
- Bodies beyond a configurable
maxBodyLengthare truncated, binary bodies are summarized by byte count, and empty Headers/Body sections are omitted - The
os.Loggersubsystem/category is configurable, defaulting to the app's bundle identifier
Full Changelog: 1.0.0...2.0.0
1.0.0
Initial release of Kuang — a small, protocol-oriented networking layer for Swift (iOS 15+, macOS 12+).
- Endpoint-driven — describe an API as an
enumconforming toEndpointProtocol;HTTPClientbuilds and executes theURLRequestwithasync/await - Typed responses — decoded with a configurable
JSONDecoder; transport and HTTP failures map to a singleNetworkErrortype - Pluggable authorization —
.none/.bearerToken/.custom(_:)per endpoint;BearerTokenAuthorizationProviderreads the token lazily on each request - Interceptors —
adapt/retryhooks viaNetworkInterceptorProtocol, with a built-inRetryInterceptorfor transient failures - Pluggable logging —
NetworkLoggingProtocol, shippingConsoleNetworkLoggerandDisabledNetworkLogger - Server error messages —
ErrorMessageParsingProtocolextracts them intolocalizedDescription; error strings localized in English and Brazilian Portuguese - Testable without the network — inject a fake session through the client's session protocol