Skip to content

feat: debug logging for requests and responses #5

@0xneobyte

Description

@0xneobyte

Problem

When an integration issue occurs there is no way to inspect what the SDK is sending and receiving without modifying SDK source. Request payloads, response bodies, headers, and retry attempts are all invisible to the caller. This makes debugging in production applications difficult.

Proposed Behaviour

Add an optional log_level parameter to the client. When set to "debug", the SDK logs each request and response through the standard Python logging module.

client = BrainusAI(log_level="debug")

Log output includes: HTTP method, URL, request body, response status, and retry attempts. The API key is always redacted.

Files to Modify

File Change
src/brainus_ai/client.py Add log_level param and logging calls in _make_request

Acceptance Criteria

  • log_level="debug" logs request and response details
  • API key is fully redacted in all log output
  • Default behaviour (no log_level) produces no output
  • Logging goes through the standard logging module, not print
  • Retry attempts are logged with attempt number

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions