Skip to content

2.0.0

Latest

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