Skip to content

Atom Networking Logging Improvements

Latest

Choose a tag to compare

@krishnavarma1 krishnavarma1 released this 02 Dec 00:16
19ce322

Introduction

This PR introduces improvements to Atom's networking diagnostics and logging implementation. The changes focus on keeping diagnostic formatting internal to Atom, improving the clarity of the logging output, and ensuring sensitive information is excluded while preserving useful debugging information.

Motivation

Atom provides an optional logging mechanism that allows developers to inspect networking activity, including outgoing requests, incoming responses, task metrics, and networking errors.

Previously, this functionality relied on custom implementations of Foundation's debugDescription property. To better encapsulate this behavior within Atom, we are introducing an internal formatting property specifically intended for Atom's networking diagnostics.

Additionally, this provides an opportunity to review and simplify the information included in our logs, ensuring developers have sufficient context to troubleshoot networking issues without including sensitive request or response data.

Proposed Solution

Introduce an internal atomLogDescription property to replace the existing custom debugDescription implementations and update the interceptor to explicitly use Atom's own diagnostic formatting.

The following improvements are included:

  • Diagnostic formatting: Keep Atom's custom formatting internal to the library without modifying Foundation's default debugging behavior.
  • Request and response headers: Retain header names to help developers identify which headers are present without exposing their values.
  • Request body: Report the size of the request body instead of its contents.
  • Request URL: Include only the scheme and host, excluding paths, query parameters, fragments, and user information.
  • Error reporting: Report networking errors using their domain and code instead of localized descriptions.
  • Code cleanup: Remove formatting utilities that are no longer used.
  • Test coverage: Update existing tests and introduce additional regression tests to validate the new formatting behavior.

The existing interceptor, logging mechanism, and isLogEnabled configuration remain unchanged. Logging continues to be disabled by default.

Additional Information

The updated logging implementation intentionally retains useful diagnostic information, such as HTTP methods, header names, response status codes, task identifiers, error codes, and request duration.

These changes allow us to maintain a consistent and useful debugging experience while keeping Atom's diagnostic behavior self-contained.

No changes to the public networking API or existing networking behavior.