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 logLevel parameter to the client. When set to "debug", the SDK logs each request and response.

const client = new BrainusAI({ apiKey: 'brainus_...', logLevel: '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/client.ts Add logLevel config option and logging calls in makeRequest
src/types.ts Add logLevel field to BrainusAIConfig

Acceptance Criteria

  • logLevel: "debug" logs request and response details
  • API key is fully redacted in all log output
  • Default behaviour (no logLevel) produces no output
  • 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