Skip to content

Releases: diegollopis/Kuang

Release list

2.0.0

Choose a tag to compare

@diegollopis diegollopis released this 07 Jul 01:00

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 maxBodyLength are truncated, binary bodies are summarized by byte count, and empty Headers/Body sections are omitted
  • The os.Logger subsystem/category is configurable, defaulting to the app's bundle identifier

Full Changelog: 1.0.0...2.0.0

1.0.0

Choose a tag to compare

@diegollopis diegollopis released this 07 Jul 01:00

Initial release of Kuang — a small, protocol-oriented networking layer for Swift (iOS 15+, macOS 12+).

  • Endpoint-driven — describe an API as an enum conforming to EndpointProtocol; HTTPClient builds and executes the URLRequest with async/await
  • Typed responses — decoded with a configurable JSONDecoder; transport and HTTP failures map to a single NetworkError type
  • Pluggable authorization.none / .bearerToken / .custom(_:) per endpoint; BearerTokenAuthorizationProvider reads the token lazily on each request
  • Interceptorsadapt/retry hooks via NetworkInterceptorProtocol, with a built-in RetryInterceptor for transient failures
  • Pluggable loggingNetworkLoggingProtocol, shipping ConsoleNetworkLogger and DisabledNetworkLogger
  • Server error messagesErrorMessageParsingProtocol extracts them into localizedDescription; error strings localized in English and Brazilian Portuguese
  • Testable without the network — inject a fake session through the client's session protocol